Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-04-2019 12:38 PM
I couldn't see any argument in timestamp function. But can we create timestamp from date supplied?
I could also generate timestamp from other language like python or javascript. But it differs to the timestamp as in cypher query language. So, what's the best way to generate timestamp value from given date?
07-04-2019 02:40 PM
What data do you have to work with? Is it strings
/ints
or is it already a date and you're trying to go to datatime
? An example with what you have would be helpful.
RETURN datetime('2015-06-24T12:50:35.556+0100') AS theDateTime
Otherwise I'd just refer you to the manual on temporal date types
07-04-2019 03:34 PM
Ah, I don't want to get datetime. But, I want to store date as timestamp in neo4j.
I would be happy if there was something like:
timestamp('2017-2-9') // but there's no arg in timestamp function
07-04-2019 03:51 PM
And you don't want to use?
RETURN date('2015-01-14') AS theDate
datetime
is a timestamp, just by a different name. Here's the chart from the documentation showing what each data type supports
All you need to do is decide which one you need. If you only have the components of a date but are determined to have the time components included, you can do string concatenation to fill in zeros for the missing time values.
07-04-2019 07:14 PM
For getting the timestamp from datetime:
RETURN apoc.date.format(apoc.date.parse("2019-01-25 14:49:58", 'ms', 'yyyy-MM-dd HH:mm:ss'), 'ms', 'HH:mm:ss')
Result: "14:49:58"
If you have just date then timestamp: "00:00:00".
Another simpler approach:
RETURN right("2019-01-25 14:49:58", 8);
Result: "14:49:58"
All the sessions of the conference are now available online