Scenario
The time and date that the JavaScript Date object returns could vary depending on the script that a user is running. The user is seeing different time and date formats depending on how they are running the script.
Sample Script:
Solution
Running the sample script above 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:
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Netsuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Netsuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Netsuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Netsuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.