NOW()

Overview

Returns the current date and time in the currently active timezone.

USAGE

NOW([precision])

Argument Name

Description

precision

Optional. The number of desired decimal digits (0-6). Default: 0

DETAILS

NOW() is a date-time function that returns the current date and time in the currently active timezone.

The optional precision argument specifies the number of fractional digits to include in the returned value, from 0 to 6. The default of 0 appends no digits and no decimal point in string mode.

When used in string context, the return value is in the YYYY-MM-DD hh:mm:ss.uuuuuu format. If the requested precision is 0, no decimal point is included in the return value.

When used in numeric context, the return value is in the YYYYMMDDhhmmss.uuuuuu format. The value is always a DOUBLE data type, even when the requested precision is 0.

Calling NOW() more than once in a single statement returns the same date-time value: the moment at which the statement started to execute.

See UTC_TIMESTAMP() for an equivalent function using the UTC timezone.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2021-07-06 18:34:39 |
+---------------------+
SELECT NOW()+0;
+---------------------+
| NOW()+0             |
+---------------------+
| 20210706183439.0000 |
+---------------------+
SELECT NOW(6), NOW(6), NOW(6);
+----------------------------+----------------------------+----------------------------+
| NOW(6)                     | NOW(6)                     | NOW(6)                     |
+----------------------------+----------------------------+----------------------------+
| 2021-07-06 18:34:39.219218 | 2021-07-06 18:34:39.219218 | 2021-07-06 18:34:39.219218 |
+----------------------------+----------------------------+----------------------------+

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