Skip to main content
MONTH
Tom Williams avatar
Written by Tom Williams
Updated over a year ago

Type: Function

Function: MONTH

Syntax: MONTH([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 standard duration of a month in seconds (2629746, which is based on 30 days). With a datetime argument, it returns the month portion (between 1 and 12) for the provided datetime

Sample usage:

  • MONTH() is equal to 2629746

  • MONTH(created_at) returns the month of the year for the created_at field value

  • MONTH(DATE(2023, 08, 27)) => 8

  • AVG(closed_at-created_at)/MONTH()returns the time elapsed in months 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 + 2*MONTH() returns the created_at field valueplus 2 months.

Did this answer your question?