DAY
Tom Azernour avatar
Written by Tom Azernour
Updated over a week ago

Type: Function

Function: DAY

Syntax: DAY([datetime])

Description: This function has two different modes of operation, based on whether an argument is provided or not. With no arguments, it returns the duration of a day in seconds (86400). With a datetime argument, it returns the day of the month portion (between 1 and 31) for the provided datetime.

Sample usage:

  • DAY() is equal to 86400

  • DAY(created_at) returns the day of the month (between 1 and 31) for the created_at field value

  • DAY(DATE(2023, 08, 27)) => 27

  • AVG(closed_at-created_at)/DAY() returns the time elapsed in days between the creation and closing of a record. Note that the difference between two dates (closed_at-created_at) is always returned in seconds.

  • created_at + 10*DAY() returns the created_at field valueplus 10 days.

Did this answer your question?