在 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.
这篇关于如何将 java.sql.timestamp 转换为 LocalDate (java8) java.time?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
“Char 不能被取消引用"错误quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用错误)
Java Switch 语句 - 是“或"/“和"可能的?Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 语句 - 是“或/“和可能的?)
Java替换字符串特定位置的字符?Java Replace Character At Specific Position Of String?(Java替换字符串特定位置的字符?)
具有 int 和 char 操作数的三元表达式的类型是什么What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作数的三元表达式的类型是什么?)
读取文本文件并存储出现的每个字符Read a text file and store every single character occurrence(读取文本文件并存储出现的每个字符)
为什么我需要在 byte 和 short 上显式转换 char 原语Why do I need to explicitly cast char primitives on byte and short?(为什么我需要在 byte 和 short 上显式转换 char 原语?)