如何将 java.sql.timestamp 转换为 LocalDate (java8) java.time?
在 Java 8 中,如何将 Timestamp(在 java.sql 中)转换为 LocalDate(在 java.时间)?
你可以这样做:
timeStamp.toLocalDateTime().toLocalDate();<块引用>
请注意,timestamp.toLocalDateTime() 将使用 Clock.systemDefaultZone() 时区进行转换. 这可能会也可能会不是你想要的.
In Java 8, how can I convert a Timestamp (in java.sql) to a LocalDate (in java.time)?
You can do:
timeStamp.toLocalDateTime().toLocalDate();
Note that
timestamp.toLocalDateTime()will use theClock.systemDefaultZone()time zone to make the conversion. This may or may not be what you want.
相关文章