I wanted to parse a date using LocalDateTime.parse() method with the date format yyyy-MM-dd HH:mm:ss, but what I actually get is a date of format yyyy-MM-ddTHH:mm:ss. I don't need that 'T'. Please see below the code
LocalDateTime.parse("2016-10-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
The result I am getting is 2016-10-31T23:59:59. See that 'T'. The 'T' is causing issues so that I am unable to persist it to my database. I try to persist the value in a column of type datetime
; I am getting the error - org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar
.
See the values which are working
VALUES('US','101','test','firstname','middleName','preferedName','lastName',
'1989-01-01','M',1,'11221123','test@test.com','address1','address2','Bloomingdale','IL','US','689850',
1,1,'11111','2016-12-31 23:59:59')
(no T
in last value)
which is not working:
VALUES('US','101','test','firstname','middleName','preferedName','lastName',
'1989-01-01','M',1,'11221123','test@test.com','address1','address2','Bloomingdale','IL','US','689850',
1,1,'11111','2016-12-31T23:59:59')
(with the T
in the last value).