07-27-2020 07:27 AM
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
01-19-2022 12:37 PM
Sorry to raise this up again, but this is the only example I could find that might be the same thing I’m running into.
Can someone explain to me why a field with local-date-time is coming in as a json with a Timestamp key as shown below? Then when I try to build an expression to parse out only what I need, the result is correct, but running preview continually returns “null”. Or if null-safe access is off it will give me an error like it can’t evaluate .Timestamp.
01-30-2022 09:24 AM
Hi Mellisa,
Good day, I think there is no method .toString for Date object type, you can try Date.parse($LAST_DDD.timestamp).toLocaleDateString({‘format’:‘yyyy-MM-dd’})
Thanks,
EmEm
01-31-2022 05:30 AM
Thank you for the response.
Unfortunately, even trying to reference “.timestamp” of any kind, I get an error that it can’t be evaluated. Now it’s in the hands of snaplogic support. As an ugly workaround, the formatting of .timestamp can be left alone and instead write the entire results to a file/json and then read back in and manipulated, but we shouldn’t have to do that.
02-01-2022 07:04 AM
Seems like that you need to provide the current format of the timestamp for the Date.parse to work…
Date.parse($IF_ROW_PROCESSED_DT.Timestamp,“yyyy-MM-dd’T’HH:mm:ss.SSS’+0000’”).toLocaleDateString({“format”:“dd-MMM-yy”}).toUpperCase()
02-01-2022 10:47 AM
Well according to support, the snowflake Timestamp_NTZ is not compatible with snaplogic expression language. Only work around is to use a string field instead if possibe. If not in the database, then write it out to a file without manipulation and then read it in as a string in snaplogic. Not ideal, but I think candidate for snaplogic enhancement request.
Thanks again for the help.