Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the datetime from database in neo4j

I am using 2.2.5 neo4j version, I have millions of real flights. I have arrival time and departure time in datetime format.

For example: I have departure time format 2011-03-23 02:40:00 arrival time format 2011-03-23 06:20:00.

My question is I stored them in string format when I tired to convert in toint I got null. I can't find the duration of the flights. How can I calculate the duration of flights.

Thanks in Advance, your cooperation is truly appreciated!

like image 935
Dawit Haile Avatar asked Dec 27 '25 18:12

Dawit Haile


1 Answers

Unfortuantely Neo4j doesn't support dates / times natively yet. This includes both property types and date / time support functions. I believe that this is planned.

What you should probably do is to store an integer in the database. You can do this either as an addition to your datetime string (which is nice because you, as a programmer, can read it easily), or you could just store the integer.

I'd advise doing this is your programming language of choice. I started to do it in Cypher by parsing the string but then I remembered that that way leads to madness. If you'd like to try you can use the substring and toInt methods.

like image 157
Brian Underwood Avatar answered Dec 30 '25 18:12

Brian Underwood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!