Outdated Version

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

TO_SECONDS

Returns the number of seconds counting from year 0 to the input datetime.

Syntax

TO_SECONDS ( dateobj )

Arguments

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

Return Type

Integer

Examples

select to_seconds('0000-01-01');
+--------------------------+
| to_seconds('0000-01-01') |
+--------------------------+
|                    86400 |
+--------------------------+

select to_seconds('2016-03-23 08:17:01');
+-----------------------------------+
| to_seconds('2016-03-23 08:17:01') |
+-----------------------------------+
|                       63625940221 |
+-----------------------------------+