Skip to main content

Date Functions (Locked)

Row-level date and datetime functions. Signatures cite help.tableau.com. All available in Desktop 2020.1+ unless noted.

Parts and Truncation​

FunctionSignatureReturnNotes
DAYDAY(date)IntegerDay of month.
MONTHMONTH(date)IntegerMonth number.
YEARYEAR(date)IntegerYear.
WEEKWEEK(date)IntegerWeek of year.
QUARTERQUARTER(date)IntegerQuarter (1-4).
DATEPARTDATEPART('part', date, [start_of_week])IntegerGeneric; 'part' is 'year', 'quarter', 'month', 'week', 'day', 'hour', etc.
DATENAMEDATENAME('part', date, [start_of_week])StringString name of part.
DATETRUNCDATETRUNC('part', date, [start_of_week])DateTruncates to the start of the part.

Arithmetic​

FunctionSignatureReturnNotes
DATEADDDATEADD('part', N, date)DateAdd N units. Negative N to subtract.
DATEDIFFDATEDIFF('part', start, end, [start_of_week])IntegerWhole-number difference in units.

Construction​

FunctionSignatureReturnNotes
MAKEDATEMAKEDATE(year, month, day)Date2020.1+.
MAKEDATETIMEMAKEDATETIME(date, time)Datetime2020.1+. Combines a date and time.
MAKETIMEMAKETIME(hour, minute, second)Time2020.1+.

Current Values​

FunctionSignatureReturnNotes
NOWNOW()DatetimeCurrent datetime; refreshes per query.
TODAYTODAY()DateCurrent date.

Parsing​

FunctionSignatureReturnNotes
DATEPARSEDATEPARSE('format', string)Date8.2+. Format uses Java SimpleDateFormat patterns.
DATEDATE(expression)DateCoerce expression to Date.
ISDATEISDATE(string)BooleanReturns TRUE if the string is a valid date.

Common Patterns​

  • Days between order and ship: DATEDIFF('day', [Order Date], [Ship Date]).
  • Truncate to first of month: DATETRUNC('month', [Date]).
  • Year-over-year comparison: filter by YEAR([Date]) = YEAR(TODAY()) vs. YEAR([Date]) = YEAR(TODAY()) - 1.
  • Age in years: DATEDIFF('year', [Birth Date], TODAY()).

Common Anti-Patterns​

  • Using DATEDIFF('day', a, b) when you need business days; there's no built-in business-day function.
  • DATEPARSE with a wrong format string; test on a real value first.
  • Comparing datetime to date without truncation may miss same-day matches.
  • Using NOW() inside a FIXED LOD; refresh timing may not match user intent.

Version Notes​

  • MAKEDATE, MAKEDATETIME, MAKETIME require Desktop 2020.1+.
  • DATEPARSE available 8.2+ (all supported versions).