Running the sample script on the client side will use the time zone that the user’s device is using. If the computer time zone is set to EST then it will return the date and time in EST.
Running the same script as a User Event or a Scheduled Script will use NetSuite’s server time zone which is in PST.
Developers must keep this in mind specially for Scheduled Scripts. The script will run on the schedule set by the user but the date that will be returned is always in PST.
Note: To return date not in PST for User Event scripts, the developer may use the function below to Add Hours into the returned date to match user’s timezone:
Date.prototype.addHours = function(h){
this.setHours(this.getHours()+h);
return this;
}
function getTodaysDate()
{
var date = new Date();
log.debug('DEBUG', 'Date ran', date.addHours(4));
}