You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/12/23 03:30:00 UTC

[GitHub] [shardingsphere] singlemonkey commented on issue #8722: Cannot use LocalDateTime as a sharding key

singlemonkey commented on issue #8722:
URL: https://github.com/apache/shardingsphere/issues/8722#issuecomment-749907735


   > yyyy-MM-ddTHH:mm:ss
   
   I have trid but id didn't work."yyyy-MM-ddTHH:mm:ss" will throw a new error "Unknown pattern letter: T" here,i had to set datetime-pattern as "yyyy-MM-dd'T'HH:mm:ss",but the length of 'datetime-pattern' is 21 and the length of  sharding value(localdatetime) is 19,it will throw a "outOfRange" error here:
   ```
    private LocalDateTime parseDateTime(final String value) {
       return LocalDateTime.parse(value.substring(0, dateTimePatternLength), dateTimeFormatter);
   }
   ```
   
   I have saw the other issues but still couldn't find a way to solve this problem.[#8693 ](url)[#8470](url) just reported the same bug and commited code to solve this bug,but is there any solution in the current version?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org