时间戳转换localdatetime
时间: 2023-10-19 15:26:07 浏览: 121
如果你想将时间戳转换为LocalDateTime,可以使用以下方法:
1. 首先,你可以使用以下代码将时间戳转换为LocalDateTime:
```
long timestamp = 时间戳;
Instant instant = Instant.ofEpochMilli(timestamp);
ZoneId zone = ZoneId.systemDefault();
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
```
其中,`timestamp`是你要转换的时间戳。
2. 使用上述代码,你可以将时间戳转换为LocalDateTime对象。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [时间转换: LocalDateTime](https://blog.csdn.net/qq_42384113/article/details/121551493)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [LocalDateTime,LocalDate,LocalTime和Date的相互转换](https://blog.csdn.net/weixin_40357412/article/details/105583211)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文