📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

TO_DAY_OF_YEAR



Convert a date or date with time (timestamp/datetime) to a UInt16 number containing the number of the day of the year (1-366).

Syntax

TO_DAY_OF_YEAR(<expr>)

Arguments

ArgumentsDescription
<expr>date/timestamp

Return Type

SMALLINT

Examples

SELECT to_day_of_year('2023-11-12 09:38:18.165575'); ┌──────────────────────────────────────────────┐ │ to_day_of_year('2023-11-12 09:38:18.165575') │ ├──────────────────────────────────────────────┤ │ 316 │ └──────────────────────────────────────────────┘

Was this page helpful?