webCOMAND

DATEDIFF()

Return the difference in days between two date/timestamp values.

Prototype

integer DATEDIFF(mixed $end, mixed $start)

Parameters

  • end - A date ("YYYY-MM-DD") or timestamp ("YYYY-MM-DD HH:MM:SS").
  • start - A date ("YYYY-MM-DD") or timestamp ("YYYY-MM-DD HH:MM:SS").

Return

The positive or negative number of days between end and start, or NULL if there is an error, such as an invalid timestamp.

Example

SELECT OID, DATEDIFF(NOW(), META(LastModified)) AS ModifiedDaysAgo FROM User

Related

TIMEDIFF()