TIMESTAMP()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Return a DATETIME
string based on a datetime expression with an optional time offset.
USAGE
TIMESTAMP(datetime[, time_offset])
Argument Name | Description |
---|---|
| The date or datetime value |
| Optional. A time value that is added to the starting datetime |
DETAILS
TIMESTAMP()
is a date-time function that returns a DATETIME
for a date or datetime value with an optional offset.
When the second argument is specified, it is a time offset that is added to the starting datetime. It follows the standard parsing rules for time values.
The return value is a string in the format YYYY-MM-DD hh:mm:ss.uuuuuu
.
A NULL
is returned if either argument is NULL
.
EXAMPLES
SELECT TIMESTAMP('2020-01-31');
+----------------------------+
| TIMESTAMP('2020-01-31') |
+----------------------------+
| 2020-01-31 00:00:00.000000 |
+----------------------------+
SELECT TIMESTAMP('2020-01-31 01:02:03', '48:00:00');
+----------------------------------------------+
| TIMESTAMP('2020-01-31 01:02:03', '48:00:00') |
+----------------------------------------------+
| 2020-02-02 01:02:03.000000 |
+----------------------------------------------+
SELECT TIMESTAMP('2020-01-31 01:02:03', 10203);
+-----------------------------------------+
| TIMESTAMP('2020-01-31 01:02:03', 10203) |
+-----------------------------------------+
| 2020-01-31 02:04:06.000000 |
+-----------------------------------------+