Skip to content

getDayOfWeek ​

The getDayOfWeek() function returns the weekday number (0 = Sunday, 6 = Saturday) for a TheDate or SerializedTheDate.

Interactive example ​

Syntax ​

typescript
function getDayOfWeek<
	GenericInput extends TheDate | SerializedTheDate
>(
	input: GenericInput,
	timezone: Timezone = "UTC"
): number

Parameters ​

  • input: TheDate or SerializedTheDate.
  • timezone: IANA timezone. Default: "UTC".

Return value ​

An integer from 0 to 6 (0 = Sunday, 1 = Monday, ..., 6 = Saturday).

See also ​

Sources ​

Released under the MIT license.