DateTime.getMonth()
Signature
int getMonth(DateTime date)
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
Name | Type | Description |
date | DateTime | A DateTime to get the month of. |
Returns
Type | Description |
int | The 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