current_time function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 18 and above

Note

Databricks Runtime 18 is newer than Databricks Runtime 18.0, 18.1, and 18.2. Features that would previously have shipped as a later numbered version now ship as dated updates to Databricks Runtime 18 instead. For details, see About unified release notes.

Returns the current time at the start of query evaluation. All calls of current_time within the same query return the same value.

Syntax

current_time( [ precision ] )

Arguments

  • precision: An optional INTEGER literal in the range 0 to 6, indicating how many fractional digits of seconds to include. The default is 6.

Returns

A TIME.

The parentheses are optional when no precision argument is given.

Examples

> SELECT current_time();
  16:57:04.304361

> SELECT current_time;
  16:57:04.304361

> SELECT current_time(0);
  16:57:04

> SELECT current_time(3);
  16:57:04.304