Java Code Examples for java.sql.Date#toLocalDate()

The following examples show how to use java.sql.Date#toLocalDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 2
Source File: LocalDateTypeHandler.java    From mybatis-types with MIT License 5 votes vote down vote up
@Override
public LocalDate getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
    Date date = rs.getDate(columnIndex);
    if (date != null) {
        return date.toLocalDate();
    }
    return null;
}
 
Example 3
Source File: LocalDateTypeHandler.java    From mybatis-types with MIT License 5 votes vote down vote up
@Override
public LocalDate getNullableResult(ResultSet rs, String columnName) throws SQLException {
    Date date = rs.getDate(columnName);
    if (date != null) {
        return date.toLocalDate();
    }
    return null;
}
 
Example 4
Source File: DateTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 5
Source File: LocalDateTypeHandler.java    From mybatis-types with MIT License 5 votes vote down vote up
@Override
public LocalDate getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
    Date date = cs.getDate(columnIndex);
    if (date != null) {
        return date.toLocalDate();
    }
    return null;
}
 
Example 6
Source File: LocalDateAttributeConverter.java    From TeaStore with Apache License 2.0 5 votes vote down vote up
/**
* Converts database format to LocalDate.
* @param sqlDate The date to convert.
* @return The date as LocalDate.
*/
  @Override
  public LocalDate convertToEntityAttribute(Date sqlDate) {
  	if (sqlDate == null) {
  		return null;
  	}
  	return sqlDate.toLocalDate();
  }
 
Example 7
Source File: DateTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 8
Source File: DateTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 9
Source File: DateTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 10
Source File: DateTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 11
Source File: DateTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 12
Source File: DateTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test13() {
    Date d = Date.valueOf("1961-08-30");
    LocalDate ldt = d.toLocalDate();
    Date d2 = Date.valueOf(ldt);
    assertTrue(d.equals(d2), "Error d != d2");
}
 
Example 13
Source File: LocalDateAttributeConverter.java    From spring-ddd-bank with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(final Date sqlDate) {
	return (sqlDate == null ? null : sqlDate.toLocalDate());
}
 
Example 14
Source File: LocalDateAttributeConverter.java    From cms with Apache License 2.0 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(Date sqlDate) {
    return sqlDate == null ? null : sqlDate.toLocalDate();
}
 
Example 15
Source File: LocalDateConverter.java    From ee8-sandbox with Apache License 2.0 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(Date dbData) {
    return dbData != null ? dbData.toLocalDate() : null;
}
 
Example 16
Source File: LocalDateConverter.java    From HibernateTips with MIT License 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(Date dbData) {
	log.info("Convert to java.time.LocalDate");
	return dbData.toLocalDate();
}
 
Example 17
Source File: LocalDateTimeAttributeConverter.java    From spring-boot-oauth2-jwt with MIT License 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(Date date) {
	return (date == null ? null : date.toLocalDate());
}
 
Example 18
Source File: LocalDateConverter.java    From hentai-cloudy-rental with Do What The F*ck You Want To Public License 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(Date date) {
    return (date == null) ? null : date.toLocalDate();
}
 
Example 19
Source File: ResultSetWrapper.java    From core-ng-project with Apache License 2.0 4 votes vote down vote up
LocalDate getLocalDate(int index) throws SQLException {
    Date date = resultSet.getDate(index);
    if (date == null) return null;
    return date.toLocalDate();
}
 
Example 20
Source File: LocalDateAttributeConverter.java    From jpa-addressbook with The Unlicense 4 votes vote down vote up
@Override
public LocalDate convertToEntityAttribute(Date sqlDate) {
	return (sqlDate == null ? null : sqlDate.toLocalDate());
}