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

TO_DAY_OF_MONTH



Convert a date or date with time (timestamp/datetime) to a UInt8 number containing the number of the day of the month (1-31).

Syntax

TO_DAY_OF_MONTH(<expr>)

Arguments

ArgumentsDescription
<expr>date/timestamp

Aliases

Return Type

TINYINT

Examples

SELECT NOW(), TO_DAY_OF_MONTH(NOW()), DAY(NOW()); ┌──────────────────────────────────────────────────────────────────┐ │ now() │ to_day_of_month(now()) │ day(now()) │ ├────────────────────────────┼────────────────────────┼────────────┤ │ 2024-03-14 23:35:41.9479621414 │ └──────────────────────────────────────────────────────────────────┘

Was this page helpful?