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.

Parsing time like '9:00AM'

Hi,

I'm looking to parse time with AM/PM format to match data after a certain hour.

How can I do that ?

Thanks for help

1 ACCEPTED SOLUTION

return time(datetime({epochMillis:apoc.date.parse("9:00AM", "ms","hh:mma")})) does the trick.
Bottom line is that standard cypher cannot parse arbitrary formats, so APOC to the rescue to parsing and returing milliseconds. Those can be passed to datetime allowing finally initializing of a time instance.

View solution in original post

2 REPLIES 2

return time(datetime({epochMillis:apoc.date.parse("9:00AM", "ms","hh:mma")})) does the trick.
Bottom line is that standard cypher cannot parse arbitrary formats, so APOC to the rescue to parsing and returing milliseconds. Those can be passed to datetime allowing finally initializing of a time instance.

or if you have a space like I did
apoc.date.parse(c.createdDate + ' ' + c.createdTime, "ms", 'MM/dd/yyyy hh:mm:ss a')