apoc.temporal.format
Syntax |
|
||
Description |
Formats the given temporal value into the given time format. |
||
Arguments |
Name |
Type |
Description |
|
|
A temporal value to be formatted. |
|
|
|
The format to return the temporal value in. The default is: |
|
Returns |
|
Usage Examples
The following formats the current date:
RETURN apoc.temporal.format( date(), 'YYYY-MM-dd') AS output;
output |
---|
"2021-01-19" |
The following formats the current datetime:
RETURN apoc.temporal.format( datetime(), 'YYYY-MM-dd HH:mm:ss.SSSSZ') AS output;
output |
---|
"2021-01-19 10:57:25.2140+0000" |
The following formats the current time:
RETURN apoc.temporal.format( localtime(), 'HH:mm:ss.SSSS') AS output;
output |
---|
"10:57:57.8140" |
The following formats a date:
RETURN apoc.temporal.format( date( { year: 2018, month: 12, day: 10 } ), 'ISO_DATE' ) as output;
Output |
---|
"2018-12-10" |
The following formats a duration:
RETURN apoc.temporal.format( duration.between( datetime.transaction(), datetime.realtime() ) , 'HH:mm:ss.SSSS') AS output;
Output |
---|
"00:00:00.0131" |