|
same as previous, but accepts custom datetime format |
|
the same as previous, but accepts custom datetime format |
|
return the system timezone display format string |
|
provides current time millis with changing values over a transaction |
ms,s,m,h,d
and their long forms millis,milliseconds,seconds,minutes,hours,days
.
PST
, a full name such as America/Los_Angeles
, or a custom ID such as GMT-8:00
. Full names are recommended. You can view a list of full names in this Wikipedia page.
apoc.date.currentTimestamp()
provides the System.currentTimeMillis which is current throughout transaction execution compared to Cypher’s timestamp()
function which does not update within a transaction
apoc.date.convert(12345, 'ms', 'd')
convert a timestamp in one time unit into one of a different time unit
ms,s,m,h,d
and their long forms.
apoc.date.add(12345, 'ms', -365, 'd')
given a timestamp in one time unit, adds a value of the specified time unit
ms,s,m,h,d
and their long forms.
Splits date (optionally, using given custom format) into fields returning a map from field name to its value.
RETURN apoc.date.fields('2015-03-25 03:15:59')
Extracts the value of one field from a datetime epoch.
apoc.date.field(12345)
Following fields are supported:
Result field | Represents |
---|---|
'years' |
year |
'months' |
month of year |
'days' |
day of month |
'hours' |
hour of day |
'minutes' |
minute of hour |
'seconds' |
second of minute |
'zone' |
RETURN apoc.date.fields('2015-01-02 03:04:05 EET', 'yyyy-MM-dd HH:mm:ss zzz')
{
'weekdays': 5,
'years': 2015,
'seconds': 5,
'zoneid': 'EET',
'minutes': 4,
'hours': 3,
'months': 1,
'days': 2
}
RETURN apoc.date.fields('2015/01/02_EET', 'yyyy/MM/dd_z')
{
'weekdays': 5,
'years': 2015,
'zoneid': 'EET',
'months': 1,
'days': 2
}
yyyy-MM-dd HH:mm:ss
to/fromSeconds
timestamp values are in POSIX (Unix time) system, i.e. timestamps represent the number of seconds elapsed since 00:00:00 UTC, Thursday, 1 January 1970Extracts the value of one field from a datetime epoch.
RETURN apoc.date.field(12345)
Following fields are supported:
Result field | Represents |
---|---|
'years' |
year |
'months' |
month of year |
'days' |
day of month |
'hours' |
hour of day |
'minutes' |
minute of hour |
'seconds' |
second of minute |
'millis' |
milliseconds of a second |
RETURN apoc.date.field(12345, 'days')
2