This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Dealing with datetime padding
Post Body
What's the best way to deal with dates that have no padding?
E.g., if I have a datetime in the format "5/11/2020 15:05" ("dd/MM/yyyy HH:mm") then either the day or month may only have 1 digit. I can't imagine that apoc.date.convert() is really not clever enough to parse this date so I must be missing some syntactic sugar. What am I missing? Or must I deconstruct the date manually?
Edit: Here's the abomination I came up with:
WITH [item in split('2/5/2020 23:59',' ')|
CASE WHEN item CONTAINS '/' THEN split(item, '/') ELSE split(item,':') END] as s
UNWIND s as t UNWIND t as u WITH collect(toInteger(u)) as v
RETURN datetime({month:v[0],day:v[1],year:v[2],hour:v[3],minute:v[4]}) as theDamnDateTime
Author
Account Strength
100%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
16,285
Link Karma
755
Comment Karma
15,475
Profile updated: 2 days ago
Posts updated: 7 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Neo4j/comme...