CMOY( ) function

Returns the name of the month of the year for a specified date or datetime. Abbreviation for “Character Month of Year”.

Syntax

CMOY(date/datetime, length)

Parameters

date/datetime

Datetime. The field, expression, or literal value to return the month name for.

length

Numeric constant. A value between 1 and 9 that specifies the length of the output string. To display abbreviated month names, specify a smaller value.

Output

Character.

Remarks

You can use the CMOY( ) function to determine in which month of the year a date falls, and return the name of the month. Use the MONTH( ) function if you want to return the month of the year as a number (1 to 12).

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.

When specifying a literal date or datetime value for the date/datetime parameter, you are restricted to the formats in the table below, and you must enclose the value in backquotes – for example, `20141231`. For datetime values, you can use any combination of date, separator, and time formats. The date must precede the time, and you must use a separator between the two. Times must be specified using the 24-hour clock. Offsets from Coordinated Universal Time (UTC) must be prefaced by a plus sign (+) or a minus sign (-). Do not use any separators such as slashes (/) or colons (:) between the individual components of dates or times.

If the length parameter is shorter than the month name, the month name is truncated to the specified length. If the length parameter is longer than the month name, the month name is padded with blank spaces.

Date formats

Separator formats

Time formats

Examples

YYYYMMDD

single blank space

hhmmss

`20141231`

YYMMDD

the letter ‘t’

hhmm

`20141231 235959`

the letter ‘T’

hh

`141231 2359`

 

+/-hhmm

(UTC offset)

`141231t23`

+/-hh

(UTC offset)

`141231t235959-0500`

(Note: Do not use hh alone in the main time format with data that has a UTC offset. For example, avoid: hh+hhmm. Results can be unreliable.)

`141231T2359+01`

Examples

Example Return value

CMOY(`20141231`, 9)

“December ”

CMOY(`20141231 235959`, 3)

“Dec”

CMOY(Receipt_timestamp, 3)

The abbreviated month name for each value in the Receipt_timestamp field

CMOY(Invoice_date, 9)

The full month name for each value in the Invoice_date field

CMOY(Invoice_date+15, 9)

The full name of the month 15 days after each value in the Invoice_date field

Related reference
MONTH( ) function


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