Skip to content

getDayOfYear

The getDayOfYear() function returns the day of the year (1–366) for a TheDate, taking an optional timezone into account.

Interactive example

Syntax

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

Parameters

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

Return value

An integer between 1 and 366.

See also

Sources

Released under the MIT license.