Skip to main content

toMonth

Converts a date or date with time to a UInt8 number containing the month number (1-12).

Syntax

toMonth( <expr> )

Arguments

ArgumentsDescription
<expr>date/datetime

Return Type

UInt8 datatype.

Examples

SELECT toMonth(to_date(18869));
+------------------------+
| toMonth(to_date(18869)) |
+------------------------+
| 8 |
+------------------------+

SELECT toMonth(to_datetime(1630812366));
+---------------------------------+
| toMonth(to_datetime(1630812366)) |
+---------------------------------+
| 9 |
+---------------------------------+