Question
Date Time Conversion
Hi,
I have to convert "2020-08-19 03:14:58 EDT" to "yyyyMMDD'T'HHmmss" + 000 EDT format.
For this I tried using functions:
@ConvertDateFormat(.ScanDate,"yyyy-MM-DD hh:mm:ss","yyyyMMDD'T'hhmmss") + ".000 EDT"
where ScanDate is the input format i.e., "2020-08-19 03:14:58 EDT"
So the output after using this function is "20200119T031458.000 EDT" . The problem with this function is that it converts month to Jaunary
So after this i tried function
@DateTime.FormatDateTime(.ScanDate,"yyyyMMDD'T'HHmmss","","") + ".000 EDT"
This function returns NULL.
Please help in figure out how to convert in the above format
Thanks for your help.
***Edited by Moderator Marissa to update General to Product***
A few issues here Rohit,
Ultimately the format of the input that FormatDateTime expects is the outcome you are originally looking for. ConvertDateFormat appears to be your site-specific timestamp-parsing function, which if it was doing the job you wanted it to, you wouldn't have to explore FormatDateTime.
Work on getting your local implementation of ConvertDateFormat to parse the timestamp correctly. Split out your parsing and formatting components of this as it could be either of them that is breaking - test them independently. Consider then replacing your formatting component with FormatDateTime given it is available OTB.
(Pega doesn't ship an all-purpose timestamp-parsing function OTB, parseDateString parses from some commonly used formats, but not yours)