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.

How to store duration

intouch_vivek
Graph Steward

Hi,

I need to store input string 23:12:58 as duration in Neo4j node properties.
Like:
Match(n:Per{consumedTime:duration('23:12:58')})

Regards
Vivek

1 ACCEPTED SOLUTION
4 REPLIES 4

paulare
Graph Buddy
RETURN duration({hours: 23, minutes: 12, seconds:12}) as duration
╒══════════════╕
│"duration"    │
╞══════════════╡
│"P0M0DT83532S"│
└──────────────┘


WITH duration({hours: 23, minutes: 12, seconds:12}) as duration
MATCH (n:Per {consumedTime: duration}) 
RETURN n

szenyo
Node Clone

I should store it as 'PT23H12M58S' string in this format, then you can do calculations like this:
RETURN duration('PT23H12M58S').seconds;

It will give you the duration in seconds (83578 s).

Thanks a lot it worked.