09-27-2019 12:21 PM
I have tried using Date.parse() but it gives a NaN error.
09-30-2019 07:34 AM
Hi Shirali,
I have converted “Jun 17, 2019 12:00 AM” into “06/17/2019” .
This is solved in two ways in the Pipeline attached (ConvertDate_2019_09_30):
(match $date.slice(0,4){"Jan "=>“01/”,"Feb "=>“02/”,“Mar”=>“03/”,"Apr "=>“04/”,“May”=>“05/”,"Jun "=>“06/”,"Jul "=>“07/”,"Aug "=>“08/”,"Sep "=>“09/”,"Oct "=>“10/”,"Noe "=>“11/”,“Dec “=>“12/”,} + $date.slice(4,12).replaceAll(”, “,”/”))
Regards,
Nikola Minovski
09-30-2019 09:57 AM
Thank you! This worked.
Shirali
09-30-2019 11:50 AM
You can specify the format to be used for parsing by passing it as the second argument to Date.parse()
. The toLocaleDateTimeString()
method can also take an optional parameter where you can specify the format to use when turning the date into a string:
Date.parse("Jun 17, 2019 12:00 AM", "MMM dd, yyyy hh:mm a")
.toLocaleDateTimeString({format: "MM/dd/YYYY"})