ANS-0981 · SUITESCRIPT DEVELOPMENT

How Do NetSuite Scheduled Scripts Handle Time Zones?

Understand how NetSuite scheduled scripts interpret time zones for execution start times versus internal date field values.

Short answer

Scheduled scripts execute based on the client's instance time zone, configured under Home > Set Preferences. However, when using new Date() (referred to as 'today') in SuiteScript for setFieldValue, the returned value consistently reflects NetSuite server time, which is Pacific Time, regardless of the client's instance time zone.

Scenario

NetSuite users often encounter discrepancies when working with scheduled scripts and time zones. While the script's execution time appears to align with the client's instance time zone, internal date operations, such as setting a date field value using new Date(), seem to default to a different time zone, leading to confusion and incorrect data.

Solution

When a scheduled script is configured, its start time is determined by the time zone set for the client's NetSuite instance. This time zone can be configured by navigating to Home > Set Preferences, and then locating the 'Time Zone' field, which may be found under the General or Localization subtab.However, it is crucial to note that when using new Date() (often referred to as 'today' in examples) within SuiteScript, for instance, in a setFieldValue('datefield', today) operation, the value returned by new Date() consistently represents NetSuite server time. This is Pacific Time, irrespective of the client's NetSuite instance time zone where the script is running.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant