Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Issue in the new Date object (Suitelet/SS)
Hello NetSuite Gurus,
I have a problem when creating new Date object, here is the example code and result:
string = '2019-12-07 19:02:32';
string = string.substring(0,10);
string = string.split('-');
var date = new Date(parseInt(string[0]), parseInt(string[1]) - 1, parseInt(string[2]), 0, 0, 0, 0);
response.write(date);
Result (OK):
Sat Dec 07 00:00:00 PST 2019
but when I do:
string = '2019-12-08 19:02:32';
string = string.substring(0,10);
string = string.split('-');
var date = new Date(parseInt(string[0]), parseInt(string[1]) - 1, parseInt(string[2]), 0, 0, 0, 0);
response.write(date);
The result is unexpected:
Wed Dec 31 16:00:00 PST 1969
Expected result:
Sun Dec 08 2019 00:00:00
What can cause this problem?
Tagged:
3