cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

A proposal for comparing durations

The Cypher 4.0 manual says that "Duration values cannot be compared, since the length of a day , month or year is not known without knowing which day , month or year it is". While this is strictly speaking true, I don't think this is a practical issue. If I say that I am 18 years old, you don't need to ask me what year I was born in so you can calculate how many leap days you should add. For all practical purposes, 1 year and 1 day is less than 1 year and 2 days, regardless of whether either of those years is a leap year. If that would matter, you would not use years but days or weeks to measure duration, since they are invariable. The solution is in fact given in the same manual when talking about the ordering of duration values: " Duration values are ordered by normalising all components as if all years were 365.2425 days long ( PT8765H49M12S ), all months were 30.436875 ( 1/12 year) days long ( PT730H29M06S ), and all days were 24 hours long". I suggest the same conversion be used to compare duration values, since ordering in fact implies comparison, and I don't think any practical applications will suffer from this - quite the opposite, in fact.

0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online