DateTime.getMonth()

Signature

int getMonth(DateTime date)

Domain

action, condition

Description

Gets the month on the DateTime Object passed as input. Month value is 0-based. i.e. 0 for January, 11 for December.

Parameters

NameTypeDescription
dateDateTimeA DateTime to get the month of.

Returns

TypeDescription
intThe month on the date argument. The first month of the year is 0.

Cautions

The first month of the year is 0.

Example


DateTime dateNow = DateTime.now ();
int month = DateTime.getMonth (dateNow);

Result is:
month contains: 2 if it is "2004-03-11 14:59:04" now