SYSDATE_TZ()
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 system date and time in the requested time zone.
USAGE
SYSDATE_TZ(zone)
Argument Name | Description |
---|---|
| The desired time zone for the result |
DETAILS
SYSDATE_TZ()
is a date-time function that returns the current date and time in the requested time zone.
The zone
argument can be 'UTC'
, 'GMT'
, or a number that specifies the positive or negative hourly offset of the timezone.
Unlike the SYSDATE() function, fractional seconds are always included.
The return value is in the YYYY-MM-DD hh:mm:ss.uuuuuu
format when used in string context.
The return value is in the YYYYMMDDhhmmss.uuuuuu
format when used in numeric context.
Multiple calls to SYSDATE_TZ()
in a single statement base their return values on the same moment in time (the start of the statement's execution).
EXAMPLES
SELECT SYSDATE_TZ('utc');
+----------------------------+
| SYSDATE_TZ('utc') |
+----------------------------+
| 2021-07-06 18:34:39.183749 |
+----------------------------+
SELECT SYSDATE_TZ(-7)+0;
+---------------------+
| SYSDATE_TZ(-7)+0 |
+---------------------+
| 20210706123445.8394 |
+---------------------+
SELECT SYSDATE_TZ(0), SYSDATE_TZ(0), SYSDATE_TZ(0);
+----------------------------+----------------------------+----------------------------+
| SYSDATE_TZ(0) | SYSDATE_TZ(0) | SYSDATE_TZ(0) |
+----------------------------+----------------------------+----------------------------+
| 2021-07-06 18:34:50.219842 | 2021-07-06 18:34:50.219842 | 2021-07-06 18:34:50.219842 |
+----------------------------+----------------------------+----------------------------+