ANS-0544 · SUITESCRIPT DEVELOPMENT

How to Retrieve the User’s Current Time Zone in NetSuite Saved Searches and SuiteScript?

NetSuite users can accurately display and process dates and times based on the individual user's time zone, rather than the server's.

Short answer

To retrieve the user's current time zone in NetSuite, create a saved search with a Formula (Date/Time) column using `{today}`. This formula returns the date and time in the user's time zone. For script processing, the `N/format` module in SuiteScript 2.x is the recommended approach to convert the result into a JavaScript date object.

Scenario

NetSuite users often need to display or process date and time information that reflects the individual user's time zone, not the NetSuite server's default time. This is crucial for accurate reporting, data entry, and custom script logic, ensuring that time-sensitive operations are aligned with the user's local context.

Solution

To retrieve the user's current time zone in NetSuite, follow these steps:

  1. Create a saved search and add a Formula (Date) or Formula (Date/Time) column.

  2. In the formula field for this column, enter:

{today}
  1. When this saved search is executed, the {today} formula will return the date and time in the user's time zone.

  2. When calling this search from a SuiteScript 2.x script, the N/format module should be used to convert the resulting date string into a JavaScript date object for further processing.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant