Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
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?