Returns the current month, or counts forward or backwards a specified number of months. Can only be used as the second date parameter in for_date_range(date, date). All counting is relative to the first date parameter in for_date_range(date, date).




  • numberOfMonths:  A value of zero returns the entire month that the first date parameter is in. A postive integer specifies a number of full  months to count forward. A negative integer specifies a number of full months to count backwards in addition to the current full month.


  • Clicks.for_date_range(from_date(), calendar_months(0)): Returns the number of clicks for the entire month that from_date() returns.

    In the example below, from_date() returns the 21st, so calendar_months(0) returns the entire month.
    calendar_months(0) returns a full month

  • Clicks.for_date_range(today(), calendar_months(-3)): Returns the number of clicks in the current month plus the previous three full months.

    In the example below, today is the 21st. The function returns the number of clicks from the previous 3 full months, plus the current full month. Since the current month hasn't completed, metrics are returned up to the current day (the 21st).

Was this helpful?
How can we improve it?