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.

Date and time format in neo4j in given format '24-09-2019 17:40:33'

Hello guys!
I'm new to neo4j and I need some help with the date and time formatting in neo4j.
I want a query in neo4j which shows date and time in given format '24-09-2019 17:40:33'.
Please let me know how can i achieve this in neo4j.

Right now , I am getting datetime in below format:

"2019-09-24T17:43:39.151000000+05:30"

Best Regards
Akshat

4 REPLIES 4

Hey,

I don't think you can do this directly using Neo4j, but if you install the APOC (https://neo4j.com/docs/labs/apoc/current/introduction/#installation) library it has a function which does this, which can you can find here - https://neo4j.com/docs/labs/apoc/current/temporal/temporal-conversions/

So for example:

return apoc.temporal.format(datetime(), "YYYY-MM-dd HH:mm:ss")
"2019-09-25 12:06:17"

Hope that helps.

Mark

Hello Mark,

Thanks a lot and It helped a lot actually!
Can we use this query to set a value to this property while loading the data?
apoc.temporal.format(datetime(), "dd-MM-YYYY HH:mm:ss")
"25-09-2019 17:43:44"

Thanks
Akshat

yeh you can use the function anywhere, so you could certainly use it to store a value to a property. I expect more likely you'd want to store a Date value to a property and then use this function to format the data before you display it somewhere

Yes Mark ! It is like this only.