Extracts the specified date part from the given date.

See Sigma's Common Date Functions and Use Cases lab for more information about date functions, including use cases and exercises.


DatePart(precision, date, [timezone])

precision (required) Date part to be extracted. This can be “year”, "quarter", “month”, “week”, “day”, "weekday", “hour”, “minute”, “second”, “millisecond”, or "epoch".

date (required) Date or column of dates from which the date part is to be extracted.

timezone (optional) Name of IANA timezone to get the date part at (e.g., ”America/Los_Angeles”). When calculating a timezone, input dates are treated as UTC.

The output returned is presented in the organization's timezone. This may cause days, months, or years to appear offset if the specified timezone is ahead of the organization timezone. To view the output presented in the specified timezone, you can apply ConvertTimezone to it.


DatePart("year", [Invoice Date])
  • Extracts the year from each value in the column of invoice dates.
DatePart("week", Date("2007-01-10 10:00:00"))
  • Returns 2, the week number of this date (weeks in Sigma are considered to start on Sunday).

Was this page helpful?
Yes No