Levi Pruss
08/05/2025, 4:52 PMCeligo AI
08/05/2025, 4:53 PMAI generated answer (using internal Slack threads):In NetSuite, getting the current date/time in the user's timezone can be achieved using different methods depending on the context. Here are some methods discussed in the provided threads: 1. If you are working with SuiteScript, you can use the
N/config
and N/format
modules to get the user's timezone and format the date accordingly. However, be aware that the Date
object in SuiteScript uses the server time, which is usually Pacific Time. Here is a sample code snippet:
javascript
var timezone = config.load({type: config.Type.USER_PREFERENCES}).getValue({fieldId:"TIMEZONE"});
var usersTime = format.format({
value: new Date(),
type: format.Type.DATETIME,
timezone: timezone
});
2. If you are working with SuiteAnalytics Workbooks, you can use the SESSIONTIMEZONE
function to get the user's timezone. However, converting a date field from the server timezone to the local timezone can be a bit tricky. Here is a sample formula that was suggested:
sql
{date} - TO_NUMBER(SUBSTR(TZ_OFFSET('AMERICA/LOS_ANGELES'), 1, 3)) / 24 + TO_NUMBER(SUBSTR(TZ_OFFSET(SESSIONTIMEZONE), 1, 3)) / 24 + TO_NUMBER(SUBSTR(TZ_OFFSET(SESSIONTIMEZONE), 5, 2)) / (24 * 60)
This formula essentially subtracts the server timezone offset and adds the session timezone offset to the date.
Please note that these methods might not be perfect and could require some adjustments based on your specific needs.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/05/2025, 4:53 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.858279526
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838657916
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834117174
Celigo AI
08/05/2025, 4:53 PM