โ07-27-2020 07:27 AM
Hi ,
I am trying to convert a local-date-time format to dd-MMM-yy ( say for eg :13-NOV-19).
I tried various methods still could not achieve this . It could be useful if I have a method to achieve this
Thanks in advance
โ07-27-2020 11:13 AM
From what Iโm seeing you can use dd-MMM-yy, for example, Date.now().toLocaleDateString({โformatโ:โdd-MMM-yyโ}) returns โ27-Jul-20โ.
I donโt think you Timestamp value is in one of the standard formats that we typically parse (See Parsing a Date on the Expression Language Examples page of our documentation), so you may need to follow the parsing a non-standard example of Date.parse($NonStandardDate, โdd-MMM-yyโ)
Is Timestamp showing as a date-time field or a string? If itโs being treated as a string, then some other things will need to be done first.
โ07-29-2020 07:13 AM
Hi Dmiller,
Hope you are fine . Thanks for the reply my incoming date is of local-date time type . Even after using the above condition Date.now().toLocaleDateString({โformatโ:โdd-MMM-yyโ}) it returns the value as 2020-07-27 instead of 27-JUL-20 . Please advise on the same
โ08-02-2020 06:59 AM
Hi Harsha,
Good day, since the IF_ROW_PROCSSED_DT is already a Date data type you can directly invoke the method in the object
e,g,
$IF_ROW_PROCSSED_DT.toLocaleDateString({โformatโ:โyy-MMM-ddโ})
FYI, my sample data type is date-time if error โmethod doesnโt existsโ on your endโฆ try
Date.parse($IF_ROW_PROCSSED_DT.toString()).toLocaleDateString({โformatโ:โyy-MMM-ddโ})
Thanks,
EmEm
โ07-29-2020 07:31 AM
Dev recommended trying: Date.now().toLocaleDateTimeString({โformatโ:โdd-MMM-yyโ}) instead.