fbpx
Select Page

Extract the specified date part, e.g. “month”, from the given date.

Usage

DatePart(<precision>,<date>,<timezone>)

precision (required) Date part to be extracted, chosen from “year”, “month”, “week”, “day”, “hour”, “minute”, “second” and “millisecond”.

date (required) Date from which 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.

Examples

DatePart(“year”, [Invoice Date])
  • Extracts the year from the invoice dates.
DatePart(“week”, Date(“2007-01-10 10:00:00”))

More About Date Functions

Date functions are useful for analyzing date input and extracting individual time components, like year or minute, from date objects.

We are rewriting the rules of analytics. Sigma empowers domain experts to join the data conversation, answer the toughest questions, and drive insights.