Hi cja,
For your problems: The time is wrong.
The seconds are zeroed.
Let’s start off with the easier one: the seconds being zeroed. You’re using ‘datetime’, which returns hours and minutes. To get seconds, use ‘datetimetz’
As for why the time is incorrect, you’re correct in identifying it as a timezone issue. The time is being set in Pacific (-8), and your NetSuite instance is likely using GMT (+0). If we look at the times:
PST: 2017-02-10T18:24:02.000Z
GMT: 2017-02-11T02:24:00.000Z
The GMT time is 8 hours ahead of the PST time, resulting in a new day.
If the script is server-side, it is converting the time to whichever timezone is set in your NetSuite instance; if it’s client-side, it’s converting the time to the local computer’s time zone. You may need to convert the returned date from nlapiStringToDate into the desired timezone.