UTC_TIMESTAMP()
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 UTC timezone.
USAGE
UTC_TIMESTAMP([precision])
Argument Name | Description |
---|---|
| Optional. The number of desired decimal digits (0-6). Default: 0 |
DETAILS
UTC_TIMESTAMP()
is a date-time function that returns the current date and time in the UTC timezone (Coordinated Universal Time).
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 UTC_TIMESTAMP()
more than once in a single statement returns the same date-time value: the moment at which the statement started to execute.
See NOW() for an equivalent function using the currently active timezone.
EXAMPLES
SELECT UTC_TIMESTAMP();
+---------------------+
| UTC_TIMESTAMP() |
+---------------------+
| 2021-07-06 18:34:39 |
+---------------------+
SELECT UTC_TIMESTAMP()+0;
+---------------------+
| UTC_TIMESTAMP()+0 |
+---------------------+
| 20210706183439.0000 |
+---------------------+
SELECT UTC_TIMESTAMP(6), UTC_TIMESTAMP(6), UTC_TIMESTAMP(6);
+----------------------------+----------------------------+----------------------------+
| UTC_TIMESTAMP(6) | UTC_TIMESTAMP(6) | UTC_TIMESTAMP(6) |
+----------------------------+----------------------------+----------------------------+
| 2021-07-06 18:34:39.219218 | 2021-07-06 18:34:39.219218 | 2021-07-06 18:34:39.219218 |
+----------------------------+----------------------------+----------------------------+