public LocalDate getInternalLocalDate ( ColumnInformation columnInfo , TimeZone timeZone ) throws SQLException { if ( lastValueWasNull ( ) ) { return null ; } if ( length == 0 ) { lastValueNull |= BIT_LAST_FIELD_NULL ; return null ; } String raw = new String ( buf , pos , length , StandardCharsets . UTF_8 ) ; switch ( columnInfo . getColumnType ( ) . getSqlType ( ) ) { case Types . DATE : case Types . VARCHAR : case Types . LONGVARCHAR : case Types . CHAR : if ( raw . startsWith ( "0000-00-00" ) ) { return null ; } try { return LocalDate . parse ( raw , DateTimeFormatter . ISO_LOCAL_DATE . withZone ( timeZone . toZoneId ( ) ) ) ; } catch ( DateTimeParseException dateParserEx ) { throw new SQLException ( raw + " cannot be parse as LocalDate (format is \"yyyy-MM-dd\" for data type \"" + columnInfo . getColumnType ( ) + "\")" ) ; } case Types . TIMESTAMP : ZonedDateTime zonedDateTime = getInternalZonedDateTime ( columnInfo , LocalDate . class , timeZone ) ; return zonedDateTime == null ? null : zonedDateTime . withZoneSameInstant ( ZoneId . systemDefault ( ) ) . toLocalDate ( ) ; default : throw new SQLException ( "Cannot read LocalDate using a " + columnInfo . getColumnType ( ) . getJavaTypeName ( ) + " field" ) ; } }
Get LocalDate format from raw text format .