UNIX_TIMESTAMP()

Overview

Returns a time as a number of seconds since the Unix epoch began.

USAGE

UNIX_TIMESTAMP([timestamp])

Argument Name

Description

timestamp

A date value or date-time value

DETAILS

UNIX_TIMESTAMP() is a date-time function that returns a time measured in seconds since the start of the Unix epoch, which is '1970-01-01 00:00:00' UTC.

When called with the optional timestamp argument, the time returned is for the given timestamp instead of returning the current time. The return is also turned into a floating-point value number.

A NULL is returned if the argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT UNIX_TIMESTAMP(), UNIX_TIMESTAMP(NOW());
+------------------+-----------------------+
| UNIX_TIMESTAMP() | UNIX_TIMESTAMP(NOW()) |
+------------------+-----------------------+
|       1604630731 |     1604630731.000000 |
+------------------+-----------------------+
SELECT UNIX_TIMESTAMP('2020-02-01 01:30:59') AS result1,
       UNIX_TIMESTAMP('2020-02-01') AS result2;
+-------------------+-------------------+
| result1           | result2           |
+-------------------+-------------------+
| 1580520659.000000 | 1580515200.000000 |
+-------------------+-------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES