Skip to main content
Version: V1.4.1

TIMESTAMP

Syntax​

TIMESTAMP(expr)
TIMESTAMP(expr1,expr2)

Description​

The first statement returns the date and time value of the datetime expression expr.

The second statement returns the datetime expression resulting from adding the datetime expression expr1 and the time expression expr2. If expr2 contains a date, only the time value is taken.

If any parameter is NULL, the function returns NULL.

Examples​

SELECT TIMESTAMP('2020-12-31');
+----------------------------+
| TIMESTAMP('2020-12-31') |
+----------------------------+
| 2020-12-31 00:00:00.000000 |
+----------------------------+
1 row in set (0.001 sec)

SELECT TIMESTAMP('2020-12-31 12:00:00','12:00:00');
+---------------------------------------------+
| TIMESTAMP('2020-12-31 12:00:00','12:00:00') |
+---------------------------------------------+
| 2021-01-01 00:00:00.000000 |
+---------------------------------------------+
1 row in set (0.001 sec)