apoc.date.currentTimestamp

Function

apoc.date.currentTimestamp() - returns the current Unix epoch timestamp in milliseconds.

Signature

apoc.date.currentTimestamp() :: INTEGER

Usage Examples

The following returns the current timestamp in ms:

WITH apoc.date.currentTimestamp() AS outputInMs
RETURN outputinMs, datetime({epochMillis: output}) AS datetime;
Table 1. Results
outputinMs datetime

1604571467744

2020-11-05T10:17:47.744Z

The following returns the current timestamp before and after sleeping for 1000 ms:

WITH apoc.date.currentTimestamp() AS outputStart
CALL apoc.util.sleep(1000)
WITH outputStart, apoc.date.currentTimestamp() AS outputEnd
RETURN outputStart,
       datetime({epochMillis: outputStart}) AS datetimeStart,
       outputEnd,
       datetime({epochMillis: outputEnd}) AS datetimeEnd;
Table 2. Results
outputStart datetimeStart outputEnd datetimeEnd

1604571641430

2020-11-05T10:20:41.430Z

1604571642434

2020-11-05T10:20:42.434Z