ANS-0018 · SAVED SEARCHES & FORMULAS

How to Get the Day of the Week from a Date in NetSuite SQL?

Learn the specific SQL function to convert a date field into its corresponding day of the week name for reporting.

Short answer

To retrieve the full name of the day of the week from a date field in NetSuite SQL, utilize the TO_CHAR and TO_DATE functions. This combination allows for precise formatting of date values into their textual day representation, essential for custom reports and saved searches requiring day-specific data.

Scenario

Users often need to display the day of the week (e.g., 'Monday', 'Tuesday') rather than just the date itself in NetSuite custom reports or saved searches. Directly extracting this information from a standard date field requires a specific SQL function to format the date value into its textual day name.

Solution

To obtain the day of the week from a date field, use the following SQL function: TO_CHAR(TO_DATE({date}),'DAY'). This function first converts the date field into a date data type using TO_DATE, and then formats it into the full name of the day using TO_CHAR with the 'DAY' format model. Replace {date} with the actual date field ID or column name from your dataset.

Expert NetSuite Support

Need help with this NetSuite issue?

Saved Searches & Formulas consulting and configuration support

Talk to a consultant