Skip to content
Blog

Date functions

Date functions are used to manipulate date values. The following functions are supported:

FunctionDescriptionExampleResult
date_part(part, date)returns the subfield of the datedate_part('year', DATE('1995-11-02'))1995 (INT64)
datepart(part, date)alias of date_partdatepart('month', DATE('1933-12-12'))12 (INT64)
date_trunc(part, date)returns the date with specified precisiondate_trunc('month', DATE('2011-11-21'))2011-11-01 (DATE)
datetrunc(part, date)alias of date_truncdatetrunc('year', DATE('2005-12-11'))2005-12-01 (DATE)
dayname(date)returns the english name of the day of the datedayname(DATE('2022-11-07'))"Monday" (STRING)
greatest(date, date)returns the later of the two datesgreatest(DATE('2013-12-11'), DATE('2005-11-12'))2013-12-11 (DATE)
last_day(date)returns the last day of the month of the datelast_day(DATE('2022-10-11'))2022-10-31 (DATE)
least(date, date)returns the earlier of the two datesleast(DATE('2013-12-11'), DATE('2005-11-12'))2005-11-12 (DATE)
make_date(INT64, INT64, INT64)returns the date based on the given partsmake_date(1952,11,22)1952-11-22 (DATE)
monthname(date)returns the english name of the month of the datemonthname(DATE('2022-11-07'))"November" (STRING)