<h2 dir="auto">Bug Report</h2>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">5.1.1</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">ShardingSphere-JDBC</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Just a simple query sql with interval sharding algorithm config like below:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="shardingsphere:
    rules:
      sharding:
        default-database-strategy:
          none:
        default-table-strategy:
          none:
        sharding-algorithms:
          sharding-by-month:
            type: INTERVAL
            props:
              datetime-pattern: &quot;yyyy-MM-dd HH:mm:ss&quot;
              datetime-lower: &quot;2022-06-01 00:00:00&quot;
              datetime-upper: &quot;2022-12-01 00:00:00&quot;
              sharding-suffix-pattern: &quot;yyyyMM&quot;
              datetime-interval-amount: 1
              datetime-interval-unit: &quot;months&quot;"><pre class="notranslate"><code class="notranslate">shardingsphere:
    rules:
      sharding:
        default-database-strategy:
          none:
        default-table-strategy:
          none:
        sharding-algorithms:
          sharding-by-month:
            type: INTERVAL
            props:
              datetime-pattern: "yyyy-MM-dd HH:mm:ss"
              datetime-lower: "2022-06-01 00:00:00"
              datetime-upper: "2022-12-01 00:00:00"
              sharding-suffix-pattern: "yyyyMM"
              datetime-interval-amount: 1
              datetime-interval-unit: "months"
</code></pre></div>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="select id, username from user_info where created_time &gt; '2022-05-01 00:00:00' "><pre class="notranslate"><span class="pl-k">select</span> id, username <span class="pl-k">from</span> user_info <span class="pl-k">where</span> created_time <span class="pl-k">&gt;</span> <span class="pl-s"><span class="pl-pds">'</span>2022-05-01 00:00:00<span class="pl-pds">'</span></span> </pre></div>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">exec sharding failure, Method threw 'java.time.format.DateTimeParseException' exception. Text '2022-05-22T15:06:54' could not be parsed at index 10</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">IntervalShardingAlgorithm#hasIntersection calc range lower and upper endpoint called <code class="notranslate">range.lowerEndpoint().toString()</code>,  the output result format will be  "yyyy-MM-dd'T'HH:mm:ss.SSS" that with T char in middle and not match the config props "datetime-pattern: yyyy-MM-dd HH:mm:ss"，it cause parseDateTime exec failure.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    private boolean hasIntersection(final Range&lt;LocalDateTime&gt; calculateRange, final Range&lt;Comparable&lt;?&gt;&gt; range) {
        LocalDateTime lower = range.hasLowerBound() ? parseDateTime(**range.lowerEndpoint().toString()**) : dateTimeLower;
        LocalDateTime upper = range.hasUpperBound() ? parseDateTime(**range.upperEndpoint().toString()**) : dateTimeUpper;
        BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : BoundType.CLOSED;
        BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : BoundType.CLOSED;
        Range&lt;LocalDateTime&gt; dateTimeRange = Range.range(lower, lowerBoundType, upper, upperBoundType);
        return calculateRange.isConnected(dateTimeRange) &amp;&amp; !calculateRange.intersection(dateTimeRange).isEmpty();
    }
    
    private LocalDateTime parseDateTime(final String value) {
        return **LocalDateTime.parse(value.substring(0, dateTimePatternLength), dateTimeFormatter);**
    }
"><pre class="notranslate"><code class="notranslate">    private boolean hasIntersection(final Range&lt;LocalDateTime&gt; calculateRange, final Range&lt;Comparable&lt;?&gt;&gt; range) {
        LocalDateTime lower = range.hasLowerBound() ? parseDateTime(**range.lowerEndpoint().toString()**) : dateTimeLower;
        LocalDateTime upper = range.hasUpperBound() ? parseDateTime(**range.upperEndpoint().toString()**) : dateTimeUpper;
        BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : BoundType.CLOSED;
        BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : BoundType.CLOSED;
        Range&lt;LocalDateTime&gt; dateTimeRange = Range.range(lower, lowerBoundType, upper, upperBoundType);
        return calculateRange.isConnected(dateTimeRange) &amp;&amp; !calculateRange.intersection(dateTimeRange).isEmpty();
    }
    
    private LocalDateTime parseDateTime(final String value) {
        return **LocalDateTime.parse(value.substring(0, dateTimePatternLength), dateTimeFormatter);**
    }

</code></pre></div>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<p dir="auto">none</p>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<p dir="auto">none</p>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>For English only</strong>, other languages will not accept.</p>
<p dir="auto">Before report a bug, make sure you have:</p>
<ul dir="auto">
<li>Searched open and closed <a href="https://github.com/sharding-sphere/sharding-sphere/issues">GitHub issues</a>.</li>
<li>Read documentation: <a href="http://shardingsphere.io/document/current/en/overview/" rel="nofollow">ShardingSphere Doc</a>.</li>
</ul>
<p dir="auto">Please pay attention on issues you submitted, because we maybe need more details.<br>
If no response <strong>more than 7 days</strong> and we cannot reproduce it on current information, we will <strong>close it</strong>.</p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">4.0.0-RC1</p>
<h3 dir="auto">Which project did you use? Sharding-JDBC or Sharding-Proxy?</h3>
<p dir="auto">Sharding-JDBC</p>
<h3 dir="auto">Expected behavior</h3>
<h4 dir="auto">Logic SQL</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) "><pre class="notranslate"><code class="notranslate">INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) 
</code></pre></div>
<h4 dir="auto">Expected SQL</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSERT INTO `DEMO_USER3` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) "><pre class="notranslate"><code class="notranslate">INSERT INTO `DEMO_USER3` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) 
</code></pre></div>
<h3 dir="auto">Actual behavior</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" INSERT INTO `DEMO_USER3`  (id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "><pre class="notranslate"><code class="notranslate"> INSERT INTO `DEMO_USER3`  (id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
</code></pre></div>
<h3 dir="auto">Reason analyze (If you can)</h3>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="spring
  shardingsphere:
    datasource:
      names: ds0
      ds0:
        type: com.zaxxer.hikari.HikariDataSource
#        driverClassName: com.mysql.cj.jdbc.Driver
        jdbcUrl: jdbc:mysql://${db.host}:${db.port}/${db.schema}?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false
        username: ${db.username}
        password: ${db.password}
    sharding:
      tables:
        DEMO_USER:
          actual-data-nodes: ds0.DEMO_USER$-&gt;{0..4}
          table-strategy:
            inline:
              sharding-column: age
              algorithm-expression: DEMO_USER$-&gt;{age % 5}
    props:
      sql:
        show: true"><pre class="notranslate"><code class="notranslate">spring
  shardingsphere:
    datasource:
      names: ds0
      ds0:
        type: com.zaxxer.hikari.HikariDataSource
#        driverClassName: com.mysql.cj.jdbc.Driver
        jdbcUrl: jdbc:mysql://${db.host}:${db.port}/${db.schema}?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false
        username: ${db.username}
        password: ${db.password}
    sharding:
      tables:
        DEMO_USER:
          actual-data-nodes: ds0.DEMO_USER$-&gt;{0..4}
          table-strategy:
            inline:
              sharding-column: age
              algorithm-expression: DEMO_USER$-&gt;{age % 5}
    props:
      sql:
        show: true
</code></pre></div>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`Rule Type: sharding 
!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`Logic SQL: INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) 
!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`SQLStatement: InsertStatement(super=DMLStatement(super=AbstractSQLStatement(type=DML, tables=Tables(tables=[Table(name=DEMO_USER, alias=Optional.absent())]), routeConditions=Conditions(orCondition=OrCondition(andConditions=[AndCondition(conditions=[Condition(column=Column(name=age, tableName=DEMO_USER), operator=EQUAL, compareOperator=null, positionValueMap={}, positionIndexMap={0=2})])])), encryptConditions=Conditions(orCondition=OrCondition(andConditions=[])), sqlTokens=[TableToken(tableName=DEMO_USER, quoteCharacter=BACK_QUOTE, schemaNameLength=0), SQLToken(startIndex=24)], parametersIndex=13, logicSQL=INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)), deleteStatement=false, updateTableAlias={}, updateColumnValues={}, whereStartIndex=0, whereStopIndex=0, whereParameterStartIndex=0, whereParameterEndIndex=0), columnNames=[id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt], values=[InsertValue(columnValues=[org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@142918a0, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@745cf754, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@25bc65ab, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@6eab92f3, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@321b7b9e, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@21eedcde, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@67396475, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@55b74e6b, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@3c1908c8, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@6bc62bb9, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@47f0e078, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@28db2afb, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@5c703860])]) 
!@#$`2019-05-30 15:39:31,786`[//]`INFO `main`ShardingSphere-SQL`Actual SQL: ds0 ::: INSERT INTO `DEMO_USER3`  (id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ::: [U57345@abc, goTmtbNosOdrALL3PQIqOA==, 2333, ivo9Lm8d4771fu2hfAO5vw==, alkaksdjflk, fSPTMmlED6BMfs57Dhwpug==, adf-key, 12.5744334, 1112.578867, 2019-05-30, 1559201970400, 1559201970400, -1] 
"><pre class="notranslate"><code class="notranslate">!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`Rule Type: sharding 
!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`Logic SQL: INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) 
!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`SQLStatement: InsertStatement(super=DMLStatement(super=AbstractSQLStatement(type=DML, tables=Tables(tables=[Table(name=DEMO_USER, alias=Optional.absent())]), routeConditions=Conditions(orCondition=OrCondition(andConditions=[AndCondition(conditions=[Condition(column=Column(name=age, tableName=DEMO_USER), operator=EQUAL, compareOperator=null, positionValueMap={}, positionIndexMap={0=2})])])), encryptConditions=Conditions(orCondition=OrCondition(andConditions=[])), sqlTokens=[TableToken(tableName=DEMO_USER, quoteCharacter=BACK_QUOTE, schemaNameLength=0), SQLToken(startIndex=24)], parametersIndex=13, logicSQL=INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`)  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)), deleteStatement=false, updateTableAlias={}, updateColumnValues={}, whereStartIndex=0, whereStopIndex=0, whereParameterStartIndex=0, whereParameterEndIndex=0), columnNames=[id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt], values=[InsertValue(columnValues=[org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@142918a0, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@745cf754, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@25bc65ab, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@6eab92f3, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@321b7b9e, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@21eedcde, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@67396475, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@55b74e6b, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@3c1908c8, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@6bc62bb9, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@47f0e078, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@28db2afb, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@5c703860])]) 
!@#$`2019-05-30 15:39:31,786`[//]`INFO `main`ShardingSphere-SQL`Actual SQL: ds0 ::: INSERT INTO `DEMO_USER3`  (id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ::: [U57345@abc, goTmtbNosOdrALL3PQIqOA==, 2333, ivo9Lm8d4771fu2hfAO5vw==, alkaksdjflk, fSPTMmlED6BMfs57Dhwpug==, adf-key, 12.5744334, 1112.578867, 2019-05-30, 1559201970400, 1559201970400, -1] 

</code></pre></div>