How to convert java.sql.timestamp to LocalDate (java8) java.time?(如何将 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.
这篇关于如何将 java.sql.timestamp 转换为 LocalDate (java8) java.time?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 java.sql.timestamp 转换为 LocalDate (java8) java.time?
基础教程推荐
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
