cancel
Showing results for 
Search instead for 
Did you mean: 

Need help withTime format Conversion

Shrabanti
New Contributor II

Hi All,
I am trying change a date format with expression.

Input is a string value: “04/23/2021 12:00:00 AM”
Output should be ‘yyyy-MM-dd HH:mm:ss’ format

I am trying data parse the incoming date format but unable find proper format for input date.
Date.parse($CertActivityDate,“mm/dd/yyyy hh:mm:ss AM”).toLocaleDateTimeString( { “format”:“yyyy-MM-dd HH:mm:ss” } )

Could you please siggest.

4 REPLIES 4

bojanvelevski
Valued Contributor

Hi @Shrabanti,

Use the following expression:

Date.parse("04/23/2021 12:00:00 AM","MM/dd/yyyy HH:mm:ss a").toLocaleDateTimeString({"format":"yyyy-MM-dd HH:mm:ss"})

Regards,
Bojan

@bojanvelevski Thank you it worked.
Could you please also point me where I can see all different time formats.

Thanks & Regards,
Shrabanti

You can refer to these links for more information:

SimpleDateFormat

ParsingDate

@Shrabanti

The below post looks useful:

Regards,
Spiro Taleski