RE: SuiteScript 2.0 local DateTime or DateTime Math
My server is in the Northwest region but our corporate office is on the east coast…
I need to be able to record a datetime within a suitescript 2.0 scheduled script.
How can I either…
- retrieve the current, local (Eastern) timezone datetime, or…
- retrieve the current datetime and add 3 hours to it…
Thanks
I use something like this:
var system_offset = 420; // System offset from GMT, in minutes (for us, we are in Pacific time)
var user_offset = new Date().getTimezoneOffset() – system_offset; // User offset from System offset
You can then use user_offset for your date calculations.
So, on the east coast that would be 300…
…but that would not account for daylight savings time if it is in minutes… correct?
Correct. At the moment I have to change that system_offset value twice a year. *sigh*