Question

4
Replies
625
Views
Solved

Text property to datetime - Dateformat

Hi,

We need to parse a text property with a specific datetime format (YYYY-mm-DD hh:mi:ss) to a datetime property in Pega. Does it exist some functionality? We have been reading posts but it is not clear and using expressions it would be something like that:

@String.toDateTime(@substring(Primary.executed_at,5,7)+"/"+@substring(Primary.executed_at,8,10)+"/"+@substring(Primary.executed_at,2,4)+" "+@substring(Primary.executed_at,10,16))

Another option is using Java code:

java.util.Date opdate = new java.text.SimpleDateFormat(date_format, Locale.ENGLISH).parse(date_value);

Thank you.

***Moderator Edit-Vidyaranjan: Updated Platform Capability***