本文整理汇总了Java中java.sql.Timestamp.toLocalDateTime方法的典型用法代码示例。如果您正苦于以下问题:Java Timestamp.toLocalDateTime方法的具体用法?Java Timestamp.toLocalDateTime怎么用?Java Timestamp.toLocalDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.Timestamp
的用法示例。
在下文中一共展示了Timestamp.toLocalDateTime方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToEntityAttribute
import java.sql.Timestamp; //导入方法依赖的package包/类
/**
* Converts database format to LocalDateTime.
* @param sqlTimestamp The date time to convert.
* @return The date as LocalDateTime.
*/
@Override
public LocalDateTime convertToEntityAttribute(Timestamp sqlTimestamp) {
if (sqlTimestamp == null) {
return null;
}
return sqlTimestamp.toLocalDateTime();
}
示例2: convertToEntityAttribute
import java.sql.Timestamp; //导入方法依赖的package包/类
@Override
public LocalDateTime convertToEntityAttribute(Timestamp databaseValue) {
if (databaseValue == null){
return null;
}
return databaseValue.toLocalDateTime();
}
示例3: convertToLocalDateTime
import java.sql.Timestamp; //导入方法依赖的package包/类
/**
* Converts a {@link Timestamp} to a {@link LocalDateTime}.
*
* @param time {@link Timestamp}
* @return {@link LocalDateTime}
*/
public static LocalDateTime convertToLocalDateTime(Timestamp time) {
if (time == null) {
return null;
}
return time.toLocalDateTime();
}
示例4: test42
import java.sql.Timestamp; //导入方法依赖的package包/类
@Test
public void test42() throws Exception {
Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
LocalDateTime ldt = ts1.toLocalDateTime();
Timestamp ts2 = Timestamp.valueOf(ldt);
assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
}
示例5: convertToEntityAttribute
import java.sql.Timestamp; //导入方法依赖的package包/类
@Override
public LocalDateTime convertToEntityAttribute(Timestamp databaseValue) {
if (databaseValue != null) {
return databaseValue.toLocalDateTime();
} else {
return null;
}
}
开发者ID:crowdcode-de,项目名称:spring-cloud-performance-tuning,代码行数:9,代码来源:LocalDateTimePersistenceConverter.java
示例6: getValue
import java.sql.Timestamp; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <V> V getValue(ResultSet rs, int colIndex) throws SQLException {
final Timestamp timestamp = rs.getTimestamp(colIndex);
return timestamp != null ? (V)timestamp.toLocalDateTime() : null;
}
示例7: convertToEntityAttribute
import java.sql.Timestamp; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public LocalDateTime convertToEntityAttribute(Timestamp time) {
return (time == null ? null : time.toLocalDateTime());
}