简体   繁体   中英

Handling Datetime in Cypher for neo4j?

I have the datetime field in the property of the node, I can return the values, but not working for WHERE clause在此处输入图片说明

If I use where for specific date its not returning在此处输入图片说明

在此处输入图片说明

Also i want to return the last 3 days transaction, i tried datetime() minus datetime('2020-03-02T00:01:44.68Z'), i couldn't return

Yes, Found it, datetime field need casting to filter the date or datetime Thanks

在此处输入图片说明

在此处输入图片说明

one thing i couldn't is to get the last 3 days, i have to check the t.TxnDateTime and the current datetime() difference of 3 days

As documented , comparisons can only be done between temporal instant values of the same type. For example, a date cannot be compared to a datetime , but it can be compared to another date .

Also, you can use an appropriate duration function (such as duration.inSeconds() ) to subtract 2 temporal values, creating a duration . And you can then access a component of that duration using an appropriate property (such as seconds ).

For example, this query:

WITH duration.inSeconds(
  date({year:2000, month:1, day:1}),
  date({year:2000, month:1, day:2})) AS durationInSeconds
RETURN durationInSeconds, durationInSeconds.seconds

returns:

╒═══════════════════╤═══════════════════════════╕
│"durationInSeconds"│"durationInSeconds.seconds"│
╞═══════════════════╪═══════════════════════════╡
│"P0M0DT86400S"     │86400                      │
└───────────────────┴───────────────────────────┘

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM