cancel
Showing results for 
Search instead for 
Did you mean: 

Date formatting

Harsha3
New Contributor III

Hi ,

I am trying to convert a local-date-time format to dd-MMM-yy ( say for eg :13-NOV-19).
I tried various methods still could not achieve this . It could be useful if I have a method to achieve this

Thanks in advance

image

11 REPLIES 11

del
Contributor III

@mmussitsch,

As an alternative to writing/reading a JSON file, try this (or similar expression as-needed) in your mapper using the JSON parse() and stringify() in combination:

JSON.parse(JSON.stringify($LAST_RUN_DATE))
or
JSON.parse(JSON.stringify($LAST_RUN_DATE.Timestamp))

While I don’t have access to the Snowflake Timestamp_NTZ type to test, I’ve tested this on a SQL Server DateTime2 field (which is also an incompatible local-date-time) and it converts its value to a string type.

mmussitsch
New Contributor II

Thanks for this suggestion.
One thing I uncovered, and I can’t believe it wasn’t mentioned to me, but was on the Snowflake Select snap, the Handle Timestamp and Date Time Data option. I hadn’t seen that and when I selected the SnapLogic Date Time format in Regional Time Zone option, the $LAST_RUN_DATE field would come as a single field and not put the .Timestamp in a sub-object. Ugh. This was a painful lesson.