NOW()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the current date and time in the currently active timezone.
USAGE
NOW([precision])
Argument Name | Description |
|---|---|
| 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_
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 |
+----------------------------+----------------------------+----------------------------+
