uma496
(Murala Umamaheswara Rao)
July 19, 2022, 3:03pm
1
Hi Team,
I have a property of type text is holding a value in format of “dd-MMM-yyyy hh:mm:ss” and this is coming from an API.
i wanted to convert this text/string to pega datetime (dd-MMM-yyyy hh:mm:ss) to use it in table layout and for sorting purpose.
i tried todatetime() but its not working as expected.
Please help on the above to parse datetime.
Thanks.
@uma496
Could you try using DateTime • parseDateString Function on passing the date String format? It returns the respective Date in the format.
uma496
(Murala Umamaheswara Rao)
July 20, 2022, 3:33am
3
Hi, @PraveenSiva
Here we need datetime string to datetime property.
Can you help on this please.
@uma496 Hi
Try this one
ex; A property is having a type of text and the value is "2022-07-20T11:10:15.82 "
Use this function
@String.replaceAll (@String.replaceAll (param.PropertyName,“-”,“”),“:”,“”) and output is :20220720T111015.82
uashok93
(Ashok Kumaresan)
July 20, 2022, 2:07pm
5
@SaiG5925 I dont think this function will help , Usually Pega date contains GMT . I dont see the GMT in your function
@uma496
Please check the below post ,
https://support.pega.com/question/convert-iso-datetime-pega-datetimehttps://support.pega.com/question/convert-iso-datetime-pega-datetime
@uashok93 Hi
Use this approach, you can include the time format in the property value so that you can get the exact output.
ex; A property is having a type of text and the value is "2022-07-20T19:50:15.02 GMT "
@String.replaceAll (@String.replaceAll (param.PropertyName,“-”,“”),“:”,“”) and output is: 20220720T195015.02 GMT
Now it shows the Pega date time format. Check it once
Thank you
uma496
(Murala Umamaheswara Rao)
July 21, 2022, 8:13am
7
@SaiG5925
Hi Sai,
thanks for reply.
but i’m having the text type datetime of format like dd-MMM-yyyy hh:mm:ss that means “21-07-2022 13:39:00” which is coming form service (please refer attachement)
so, i have to convert the above text datetime to pega datetime. please suggest on this.
Veeru_16
(Veera Gundu)
February 16, 2023, 2:19am
8
This should work.
@toDateTime (@whatComesBeforeFirst (@replaceAll (@replaceAll (.myStringPropertyName, “-”,“”),“:”,“”),‘.’)+“.000 GMT”)