TIMESTAMP()

Overview

Return a DATETIME string based on a datetime expression with an optional time offset.

USAGE

TIMESTAMP(datetime[, time_offset])

Argument Name

Description

datetime

The date or datetime value

time_offset

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.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

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              |
+-----------------------------------------+

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