Skip to content

getHour

The getHour() function returns the hour (0–23) of a TheDate, adjusted by an optional timezone.

Interactive example

Syntax

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

Parameters

  • input: TheDate value.
  • timezone: Timezone (optional).

Return value

An integer between 0 and 23.

See also

Sources

Released under the MIT license.