Home

extractdoy

extractdoy is a date-related function used to compute the day of the year from a calendar date. The function returns an integer representing the ordinal day, where January 1 is 1 and December 31 is 365 in common years or 366 in leap years.

Inputs are typically a date, datetime, or timestamp value. The function ignores time-of-day and uses only the

Output is an integer in the range 1–366.

Leap-year behavior: February 29 is day 60 on leap years.

Examples: extractdoy('2023-02-15') yields 46. extractdoy('2020-02-29') yields 60.

Common usage: It is often provided as a built-in function or as part of a date-part extraction

Limitations: If the input date cannot be parsed, the function may raise an error or return null.

calendar
date.
In
some
implementations,
time
zone
information
may
affect
the
date
portion
if
the
input
is
a
timestamp
in
a
specific
zone;
other
implementations
normalize
to
a
standard
date
(for
example,
UTC)
before
calculation.
suite.
Similar
operations
exist
under
names
such
as
dayofyear,
doy,
or
date_part('doy',
date)
depending
on
the
platform.
In
some
systems,
the
exact
handling
of
historical
dates
or
very
large
date
values
can
vary.
See
also
related
concepts
such
as
dayofyear
and
ordinal
date.