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 2021/08/02 09:45:46 UTC

[GitHub] [shardingsphere] zjcnb commented on issue #11364: when use a LocalDateTime filed as sharding key,IntervalShardingAlgorithm.java will throw java.time.format.DateTimeParseException: Text '2021-07-08T21:36:12' could not be parsed at index 10]

zjcnb commented on issue #11364:
URL: https://github.com/apache/shardingsphere/issues/11364#issuecomment-890885773


   > > sharding-algorithm-table-by-year-month: # 根据时间进行按年月分表策略
   > > type: INTERVAL
   > > props:
   > > datetime-pattern: "yyyy-MM-dd HH:mm:ss"
   > > datetime-lower: "2021-01-01 00:00:00"
   > > datetime-upper: "2021-12-31 23:59:59"
   > > sharding-suffix-pattern: yyyyMM
   > > datetime-interval-amount: 1
   > > datetime-interval-unit: MONTHS
   > 
   > localDateTime is following ISO-8601 formats, such as `2007-12-03T10:15:30`.
   > @zjcnb But when i set datetime-pattern `yyyy-MM-dd'T'HH:mm:ss.SSS`,
   > IntervalShardingAlgorithm.dateTimePatternLength value is 25,it make IntervalShardingAlgorithm.parseDateTime dateString.substring() exception.
   
   It seems that the ISO-8601 format is not supported,  you can try to implement the StandardShardingAlgorithm interface to meet your business needs.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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