Skip to content

getDayOfWeek

The getDayOfWeek() function returns the day of the week of a TheDate (1 = Monday, 7 = Sunday) taking an optional timezone into account.

Interactive example

Syntax

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

Parameters

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

Return value

An integer from 1 to 7 representing the ISO weekday.

See also

Sources

Released under the MIT license.