12-05-2018 12:32 PM
Hi everyone,
I’ve been trying to convert data I’m receiving from a varchar (20171211 125023) into a datetime (2017-12-11 12:50:23). I’ve been messing with the mapper but I feel like I’m at a road block now. I was wondering if someone in the community has any success in this.
02-21-2020 12:05 PM
I am calling the snapLogic Activity API and its returning the date in the format as “2020-02-21T17:44:19.996000+00:00”
I am trying to store this data into SQL server and SQL server doesn’t accept this data in DateTime data type. I tried to use some simple pare method and it’s still not accepting. Later I used some complex Parse method like below, but its still not working.
Date.parse($create_time,“yyyy-MM-dd’T’HH:mm:ss.SSSSSSX”).toLocaleDateTimeString({“format”:“yyyyMMdd-HHmmss”})
Can someone provide how to parse the data in this format “2020-02-21T17:44:19.996000+00:00” to DateTime which is compatible with SQL server ?
02-21-2020 01:04 PM
I believe you just need:
Date.parse($create_time).toLocaleDateTimeString({"format":"yyyyMMdd-HHmmss"})
02-21-2020 02:45 PM
Awesome, this worked! Thanks for your quick help.
Note: Inorder to insert that into SQL server I have changed the output to a format SQL server supporst. So the parse function I used is Date.parse($create_time).toLocaleDateTimeString({“format”:“yyyy-MM-dd’T’HH:mm:ss.SSSSSS”})
Thanks again!
04-26-2020 01:16 PM
Hi, This thread was very helpful as I was facing the same issue - I have another question, what to do if we want to pass null values in this same format?