apoc.date.format
Function
apoc.date.format(time Long, unit String, format String, timezone String)
- returns a string representation of the time value.
The time unit (default: ms), date format (default: ISO), and time zone (default: current time zone) can all be changed.
Signature
apoc.date.format(time :: INTEGER?, unit = ms :: STRING?, format = yyyy-MM-dd HH:mm:ss :: STRING?, timezone = :: STRING?) :: (STRING?)
Input parameters
Name | Type | Default |
---|---|---|
time |
INTEGER? |
null |
unit |
STRING? |
ms |
format |
STRING? |
yyyy-MM-dd HH:mm:ss |
timezone |
STRING? |
Usage Examples
The
The The |
The following converts a datetime in epoch millis to yyyy-MM-dd
format:
WITH datetime("2020-11-04T11:23:22").epochMillis AS datetime
RETURN apoc.date.format(datetime, "ms", "yyyy-MM-dd") AS output;
output |
---|
"2020-11-04" |
The following converts a GMT datetime in epoch millis to yyyy-MM-dd’T’HH:mm:ssz
format, using the Australian/Sydney
timezone:
WITH datetime("2020-11-04T11:23:22+00:00").epochMillis AS datetime
RETURN apoc.date.format(datetime, "ms", "yyyy-MM-dd'T'HH:mm:ssz", "Australia/Sydney") AS output;
output |
---|
"2020-11-04T22:23:22AEDT" |
Was this page helpful?