cancel
Showing results for 
Search instead for 
Did you mean: 

Time format Conversion not working

Shrabanti
New Contributor II

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

Input is a string value: “9-JUN-21 10.06.39.000000 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($OrderDetailUpdateDate,“dd-MMM-yyyy’ 'HH:mm:ss.SSSXXX AM”).toLocaleDateTimeString({“format”:“yyyy-MM-dd HH:mm:ss”})

Could you please siggest.

2 REPLIES 2

koryknick
Employee
Employee

Hi @Shrabanti - I think this is what you’re looking for:

Date.parse(“9-JUN-21 10.06.39.000000 AM”, “dd-MMM-YY hh.mm.ss.SSSSSS aa” ).toLocaleDateTimeString( { “format” : “yyyy-MM-dd HH:mm:ss” } )

SnapLogic date parsing using Joda formatting. Here is a good reference on the format strings:
https://www.joda.org/joda-time/key_format.html

Shrabanti
New Contributor II

Thank you it worked…