EOMONTH( ) function

Returns the date of the last day of the month that is the specified number of months before or after a specified date.

Syntax

EOMONTH(<date/datetime> <,months>)

Parameters

date/datetime

Optional. Datetime. The field, expression, or literal value from which to calculate the end-of-month date. If this parameter is omitted, the end-of-month date is calculated from the current operating system date.

months

Optional. Numeric constant. Specifies the number of months before or after the date in the date/datetime parameter. If this parameter is omitted, the default of ‘0’ (zero) is used. You cannot specify months if you have omitted the date/datetime parameter.

Output

Datetime. The date value is output using the current ACL date display format.

Remarks

If the value in the months parameter is positive, the output date is more recent than the specified date/datetime. If the value is negative, the output date is prior to the specified date/datetime. If the parameter is omitted, or a value of ‘0’ (zero) is used, the output date is the last day of the month in which the date/datetime occurs.

The date/datetime parameter can accept a datetime value, but the time portion of the value is ignored.

A field specified for the date/datetime parameter can use any date or datetime format, as long as the field definition correctly defines the format. A literal date value must use one of the following formats: YYYYMMDD or YYMMDD. You must enclose literal date values in backquotes (for example, `20141231`).

You can use the EOMONTH( ) function to return the date of the first day of a month by adding 1 day to the result.

Use the GOMONTH( ) function if you want to return the exact date, rather than the date of the last day of the month, that is the specified number of months before or after a specified date.

Examples

Example Return value

EOMONTH(`20140115`, 3)

30 Apr 2014

Assumes a current ACL date display format of DD MMM YYYY

EOMONTH(`20140115`, -3)

31 Oct 2013

Assumes a current ACL date display format of DD MMM YYYY

EOMONTH(`20140115`)

31 Jan 2014

Assumes a current ACL date display format of DD MMM YYYY

EOMONTH( )

The last day of the month for the current operating system date.

EOMONTH(Invoice_date, 3)

The last day of the month that falls three months after each date in the Invoice_date field.

EOMONTH(Invoice_date+15, 3)

The last day of the month that falls three months after each date in the Invoice_date field plus a grace period of 15 days.

EOMONTH(Invoice_date, -1)+1

The first day of the month in which the invoice date falls.

Related reference
GOMONTH( ) function


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback