01-09-2020 10:44 PM
Hi, I have a requirement where from the source file. I am getting date as string value ‘10/21/2019 6:16:54 PM’, I want the date to be converted into yyyy-mm-dd hh:mm:ss format.
In the example given above the output should be ‘2019-10-21 18:16:54’.
8/3/2019 4:24:00 AM for this input output should be 2019-08-03 04:24:00
for 7/3/2019 12:09:45 PM output should be 2019-07-03 12:09:45
I was able to achieve this using a complex regex but if anyone has a better way to do this please reply to this thread.
Regards
Anubhav
Solved! Go to Solution.
01-13-2020 10:18 PM
Hi Chris,
Thanks for your inputs, I was able to achieve this by using the expression below,
Date.parse($dt,‘MM/dd/yyyy h:m:s a’).toLocaleDateTimeString({“format”:“yyyy-MM-dd HH:mm:ss”})
Regards
Anubhav
01-13-2020 10:18 PM
Hi Chris,
Thanks for your inputs, I was able to achieve this by using the expression below,
Date.parse($dt,‘MM/dd/yyyy h:m:s a’).toLocaleDateTimeString({“format”:“yyyy-MM-dd HH:mm:ss”})
Regards
Anubhav