Overview
The TRUNC(DATE) function in Saved Search Formula is used to truncate a date to a specified unit, effectively setting all smaller units to their default values. In simpler terms, it allows you to round down a date to the beginning of a specific time period, such as the start of a month or year. This is particularly useful in NetSuite's Saved Searches when you need to group or filter data by specific time frames.
Understanding the Syntax
The TRUNC(DATE) function is structured as follows:
- date: The date value you want to truncate.
- format: A string that specifies the unit to which the date should be truncated.
Common Format Parameters
Unit | Valid Format Parameters | Formula | Sample Result |
|---|
Century | 'CC', 'SCC' | TRUNC({today}, 'CC')
| 01/01/2001 |
Year | 'SYYYY', 'YYYY', 'YEAR', 'SYEAR', 'YYY', 'YY', 'Y' | TRUNC({today}, 'YYYY')
| 01/01/2026 |
ISO Year | 'IYYY', 'IY', 'I' | TRUNC({today}, 'IYYY')
| 12/29/2025 |
Quarter | 'Q' | TRUNC({today}, 'Q')
| 01/01/2026 |
Month | 'MONTH', 'MON', 'MM', 'RM' | TRUNC({today}, 'MM')
| 01/01/2026 |
Week (based on day of the week on which January 1st falls) | 'WW' | TRUNC({today}, 'WW')
| 01/22/2026 |
ISO Week (starting on Monday) | 'IW' | TRUNC({today}, 'IW')
| 01/26/2026 |
Day | 'DDD', 'DD', 'J' | TRUNC({today}, 'DDD')
| 01/26/2026 |
Start Day of the Week (Sunday) | 'DAY', 'DY', 'D' | TRUNC({today}, 'DAY')
| 01/25/2026 |
Hour | 'HH', 'HH12', 'HH24' | TRUNC({today}, 'HH24')
| 01/26/2026 17:00 |
Minute | 'MI' | TRUNC({today}, 'MI')
| 01/26/2026 17:10 |
Notes:
- The sample results assume that the current date and time is: January 26, 2026, at 5:10 PM.
- The 'ISO Year' and 'ISO Week' formats follow the ISO 8601 standard, where weeks start on Monday, and the year may differ from the Gregorian calendar year.
By utilizing these format parameters, you can tailor your date truncation to meet specific reporting and analysis needs in NetSuite.
-----
If you find this information useful, let us know by reacting or commenting on this post!