For AI agents: an index of this documentation is at https://developer.rippling.com/llms.txt. Public pages have a Markdown version at the same URL with .md added.

Skip to main content
index

DATEDIFF() Function

Use with AI:Rippling AI ChatGPT Claude Cursor

Description​

Returns the difference between two dates or timestamps

Aliases: DATE_DIFF

Syntax​

DATEDIFF(unit, start, end)

Parameters​

ParameterDescriptionData TypeRequired
unitDate part for the difference (for example day, week, month, year)StringYes
startStarting date or timestampDate or timestampYes
endEnding date or timestampDate or timestampYes

Accepted datepart values​

Datepart NameDatepart Abbreviation
yearyy, yyyy
quarterqq, q
monthmm, m
dayofyeardy, y
daydd, d
weekwk, ww
weekdaydw, w
hourhh
minutemi, n
secondss, s
millisecondms
microsecondmcs
nanosecondns

Notes​

  • Public Transformations SQL spelling is DATEDIFF(...). DATE_DIFF(...) is also accepted by the parser.

Example​

SELECT
DATEDIFF('day', start_date, end_date)
FROM
rippling.employee.Employee
LIMIT
5;