How do you convert this date “2020-09-01T00:00:00.000” to this “20200901”?
I’m double checking, but I think you have to use one of the formats listed in the Parsing a Date example in the documentation.
@cjhoward18 to the rescue.
Thanks, will this work with variable?
You shouldn’t need the quotes around the variable, but it should work if it’s a string.
Then you should try:
Absolutely beautiful. It worked
The two following statements get it loaded for your from the public server, but we don’t do it that way. Once we settled on using it, we downloaded it ourselves to our Project Spaces so it’s available locally on the snaplex.
Then we use moment’s parsing and time zone corrections.
var zones = moment.tz.names(); zones.unshift("Not Set"); var timeZonedDate = moment.tz(theDateTimeString, zones[timeZoneId]); return timeZonedDate.utc();
You might want to read the moment.js documentation and then play around with it. Note that the authors do not recommend using moment for new development. At my employer, we feel this advice does not apply here, because many of the newer libraries don’t work well in snapLogic, and moment does.