Skip to content

getMonth

The getMonth() function returns the month (1–12) corresponding to a TheDate, with optional support for an IANA timezone.

Interactive example

Syntax

typescript
function getMonth<
	GenericInput extends TheDate
>(
	input: GenericInput,
	timezone?: Timezone
): number

Parameters

  • input: TheDate to analyze.
  • timezone: (Optional) IANA timezone.

Return value

An integer between 1 and 12 (January = 1).

See also

Sources

Released under the MIT license.