Actually I am trying to convert String formats into dates and following format occur:
"30-JUL-2009"
"31/12/2018"
"n"
2009-07-30
these Strings that are to be formatted as dates occur in a relationship as attributes.
Trying to match them with a regular expression as follows fails and I donnot have any idea why:
match(n:ENTITY)-[r:VALIDITY_PERIOD]-(m:ENTITY)
where apoc.meta.type(r.end_date) = "STRING"
and not r.end_date = "2009-07-30"
and trim(r.end_date) =~'^[0-9]{2}-[A-Z]{3}-[0-9]{4}$'
set r.end_date = date(datetime({epochmillis: apoc.date.parse(r.end_date, "ms", "dd-MMM-yyyy")})) return r;
this actually is my try to match and update format no 1.
it fails with the following error message:
Neo.ClientError.Statement.TypeError
Wrong argument type: Can't coerce `2009-07-30` to String
I tried with or without starting and ending string markes, both fail with same error.
MATCH (n)-[r:VALIDITY_PERIOD]-(n)
WHERE not r.start_date = '-'
WITH apoc.date.parseAsZonedDateTime(r.start_date, 'YYYY-MM-dd') AS date
RETURN date, apoc.meta.type(date), date(date), apoc.meta.type(date(date))
trying the adapted statement above leads to the following error
Neo.ClientError.Statement.TypeError
Wrong argument type: Can't coerce 2005-01-26 to String