daylight savings started yesterday
# suitescript
b
daylight savings started yesterday
s
@battk Thanks for the info about the "daylight savings". I'm using Schedule script 1.0, and will not be able to use format module. Any alternative in terms to convert the PDT to company prefered time ?
Currently, i use the below snippet. I observe that the converted time leaves with a 1 hou difference. (This is because of the PST and PDT 1 hr time difference i guess).
var currentDateTime = new Date();
var companyTimeZone = nlapiLoadConfiguration('companyinformation').getFieldText('timezone');
var timeZoneOffSet = (companyTimeZone.indexOf('(GMT)') == 0) ? 0 : new Number(companyTimeZone.substr(4, 6).replace(/\+|:00/gi, '').replace(/:30/gi, '.5'));
var UTC = currentDateTime.getTime() + (currentDateTime.getTimezoneOffset() * 60000);
var companyDateTime = UTC + (timeZoneOffSet * 60 * 60 * 1000);
nlapiLogExecution('DEBUG', "Current Company Time", "companyDateTime = " + companyDateTime);
var d = new Date(companyDateTime);
nlapiLogExecution('DEBUG', "Current Company Time", "Date/Time = " + d);
b
ive used moment timezone in the past
hopefully you are doing this with an nlobjRecord and can use something like setDateTimeValue