SYSDATE()
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.
USAGE
SYSDATE([precision])
Argument Name | Description |
---|---|
| Optional. The fractional seconds precision. Defaults to 0 |
DETAILS
SYSDATE()
is a date-time function that returns the current date and time in the time zone of the system.
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.
The return value is in the YYYY-MM-DD hh:mm:ss
format when used in string context. Fractional seconds are appended after a decimal point (".").
The return value is in the YYYYMMDDhhmmss.x
format when used in numeric context. The value is always a DOUBLE
data type.
Multiple calls to SYSDATE()
in a single statement might differ slightly in their return value.
EXAMPLES
SELECT SYSDATE();
+---------------------+
| SYSDATE() |
+---------------------+
| 2021-07-06 18:34:39 |
+---------------------+
SELECT SYSDATE()+0;
+---------------------+
| SYSDATE()+0 |
+---------------------+
| 20210706183439.0000 |
+---------------------+
SELECT SYSDATE(6), SYSDATE(6), SYSDATE(6);
+----------------------------+----------------------------+----------------------------+
| SYSDATE(6) | SYSDATE(6) | SYSDATE(6) |
+----------------------------+----------------------------+----------------------------+
| 2021-07-06 18:34:39.219218 | 2021-07-06 18:34:39.219218 | 2021-07-06 18:34:39.219218 |
+----------------------------+----------------------------+----------------------------+