Just checking my understanding for the 1K time... ...
# suitescript
m
Just checking my understanding for the 1K time... When I receive an ISO datetime from a RESTlet, I need to do this, right?
Copy code
let date = format.format({
  value: new Date(datetimeISO),
  type: format.Type.DATETIME,
  timezone: <timezone>,
});
b
depends on what you want to do with it, if you are trying to set a date/time field by value, you want a Date
if you want to set it by text, then you want to format it, though using the timezone parameter will screw you if the timezone doesnt match your user's timezone
m
I want to know the local day and month. Because sometimes it is different if it was at the end of the day.
b
i personally would recommend using moment timezone to work with dates in different timezones
🙌 1
but your code is fine if you are willing to parse
date
to separate out the month and day
m
Will try moment. Thanks. ☕
f
110% on the recommendation to use the moment library.
m
Yeah, I already tried it, and it works perfectly.
🙌 1