0

I have the same problem as described here: http://www.markhneedham.com/blog/2017/03/06/neo4j-apoc-date-parse-java-lang-illegalargumentexception-illegal-pattern-character-t-java-text-parseexception-unparseable-date-2012-11-12t084615z/

Is there anyway around it?

In short this call

RETURN apoc.date.parse("2016-01-01T15:54:11", 's','yyyy-MM-dd'T'HH:mm:ss') as value2

gives the error:

Invalid input 'T': expected whitespace, '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, ',' or ')' (line 1, column 63 (offset: 62))

"RETURN apoc.date.parse("2016-01-01T15:54:11", 's','yyyy-MM-dd'T'HH:mm:ss') as value2"

This call

RETURN apoc.date.parse("2016-01-01 15:54:11", 's','yyyy-MM-ddTHH:mm:ss') as value2

gives the error

Failed to invoke function `apoc.date.parse`: Caused by: java.lang.IllegalArgumentException: Illegal pattern character 'T'
Aqqqq
  • 816
  • 2
  • 10
  • 27

1 Answers1

3

The problem is you're using single quotes throughout the entire string, so where you start to quote the T, it looks like you're ending the string instead.

To avoid that, use double quotes for the string itself, and single quotes around the T like so:

RETURN apoc.date.parse("2016-01-01T15:54:11", 's',"yyyy-MM-dd'T'HH:mm:ss") as value2
InverseFalcon
  • 29,576
  • 4
  • 38
  • 51