DatePart
The DatePart function extracts a specified part of a date from a date value.
DatePart is a date function.
Syntax
The function has the following arguments:
Notes
- Sigma interprets date values in your organization’s time zone by default. In the DatePart function, you can optionally specify a different time zone using the timezone argument. If your organization’s time zone is not the same as the time zone of the date values in your data warehouse, the output might be offset. For more information, see Account time zone.
- In the
precisionargument,epochrefers to the Unix epoch.
Examples
Extracts the year from each value in the Invoice Date column.
Returns 2, the week number of this date in the year.
Extracts the hour from each value in the [Date] column, converted to Eastern time. In an organization set to the time zone UTC, a row with a [Date] value 2025-03-11 00:00:00 returns 20.
Based on the formulas above, the DatePart function returns the following values for the Date column:

In the precision argument, day returns the day of the month (1-31), weekday returns the day of the week (1-7, beginning on Sunday), and day_of_year returns the day of the year (1-366, accounting for leap years).
Based on the formulas above, the DatePart function returns the following values for the Date column:


