Skip to main content

CURRENT_TIMESTAMP

Description​

The function retrieves the current system time and returns it as a datetime value (DATETIME). An optional precision can be specified to adjust the number of digits in the fractional seconds part of the return value.

Syntax​

CURRENT_TIMESTAMP([<precision>])

Parameters​

ParameterDescription
<precision>Optional parameter specifying the precision of the fractional seconds part in the return value. The range is 0 to 6, and the default is 0 (no fractional seconds).
Limited by the JDK implementation: if FE is built with JDK8, the precision supports up to milliseconds (3 fractional digits), and higher precision digits will be filled with 0. If higher precision is required, please use JDK11.

Return Value​

  • Returns the current system time as a DATETIME type.
  • If the specified <precision> is out of range (e.g., negative or greater than 6), the function will return an error.

Example​

select CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP(3),CURRENT_TIMESTAMP(6);
+---------------------+-------------------------+----------------------------+
| now() | now(3) | now(6) |
+---------------------+-------------------------+----------------------------+
| 2025-01-23 11:26:01 | 2025-01-23 11:26:01.771 | 2025-01-23 11:26:01.771000 |
+---------------------+-------------------------+----------------------------+