Top | Previous | Next |
Date and Time / dateExtract |
dateExtract(date, field) Returns an integer value that is the value of the specified date field within the given date. The field must be a string, and must match one of these values:
Note: months are returned zero-indexed. That is, January is month 0, February is month 1, and so on. If this is inconvenient for you - just add one to the results.
dateExtract(toDate("2003-9-14 8:00:00"), "year") ...returns 2003
dateExtract(toDate("2009-1-15 8:00:00"), "month") ...returns 0
dateExtract(toDate("2008-1-24 8:00:00"), "month") + 1 ...returns 1 |