Important

Helios features are now enabled during weekly update windows and are no longer directly tied to SingleStore engine releases. Refer to the release notes to view the latest features available in your Helios cluster.

TIMESTAMP

The TIMESTAMP() function converts the input argument to a datetime object.

Syntax

TIMESTAMP(dateobj)

Arguments

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

Return Type

Datetime object. If dateobj is not a valid date, returns NULL.

Remarks

  • TIMESTAMP is based on UTC timezones.

  • SingleStore converts TIMESTAMP values from the current timezone to UTC for storage.

  • Minimum value: when setting a value for TIMESTAMP, if your UTC timezone is before UTC (set to UTC +<hours>) and you set TIMESTAMP to its minimum value (1970-01-01 00:00:01), the query will insert 0000-00-00 00:00:00.

  • The TIMESTAMP function supports improved segment elimination when used in WHERE clauses. See the following query example:

    SELECT ... FROM table_name WHERE TIMESTAMP(column_name) > '2000-01-01 00:00:00' AND TIMESTAMP(column_name) <= '2015-03-03 00:00:00';

Examples

SELECT TIMESTAMP('2015-03-03');
+-------------------------+
| TIMESTAMP('2015-03-03') |
+-------------------------+
| 2015-03-03 00:00:00     |
+-------------------------+

Related Topics

Last modified:

Was this article helpful?