Outdated Version

You are viewing an older version of this section. View current production version.

TO_DAYS

Returns the day number of the input date object. Day number starts with 1 being 0000-01-01 and counts sequentially.

Syntax

TO_DAYS ( dateobj )

Arguments

  • dateobj: a valid date, datetime, or parsable date string.

Return Type

Integer

Examples

select to_days('0000-01-01');
+-----------------------+
| to_days('0000-01-01') |
+-----------------------+
|                     1 |
+-----------------------+

select to_days('2016-03-23 08:17:01');
+--------------------------------+
| to_days('2016-03-23 08:17:01') |
+--------------------------------+
|                         736411 |
+--------------------------------+