Skip to content

Built-in date and time functions

NebulaGraph supports the following built-in date and time functions:

Function Description
int now() Returns the current date and time of the system time zone.
timestamp timestamp() Returns the current date and time of the system time zone.
date date() Returns the current UTC date based on the current system.
time time() Returns the current UTC time based on the current system.
datetime datetime() Returns the current UTC date and time based on the current system.

The date(), time(), and datetime() functions accept three kind of parameters, namely empty, string, and map. The timestamp() function accepts two kind of parameters, namely empty and string.

OpenCypher compatibility

  • Time in openCypher is measured in milliseconds.
  • Time in nGQL is measured in seconds. The milliseconds are displayed in 000.

Examples

> RETURN now(), timestamp(), date(), time(), datetime();
+------------+-------------+------------+-----------------+----------------------------+
| now()      | timestamp() | date()     | time()          | datetime()                 |
+------------+-------------+------------+-----------------+----------------------------+
| 1625470028 | 1625470028  | 2021-07-05 | 07:27:07.944000 | 2021-07-05T07:27:07.944000 |
+------------+-------------+------------+-----------------+----------------------------+

Last update: March 13, 2023