How would I go about converting this date format f...
# suitescript
n
How would I go about converting this date format from an external system to a date that I can save in NS.
Copy code
{
   eventid: 781173199,
   utc: "2022-02-02 05:21:41",
   time: "2022-02-02 15:21:41",
   org: "Test Account",
   site: "New",
So I have a local time as text as newTime = "2022-02-02 152141" and want to write it into a Date/Time field. format.parse?
b
format.parse is basically only appropiate for strings to come from netsuite apis
its pretty bad for strings from external sources
you can use the Date constructor if you manipulate the utc value into iso8601 format
Copy code
new Date("2022-02-02T05:21:41.000Z")
else use a Date library like moment js to do your parsing
139 Views