使用LocalDateTime 获取某个时间点的小时
时间: 2023-10-26 07:27:39 浏览: 90
使用LocalDateTime获取某个时间点的小时可以通过调用LocalDateTime对象的getHour()方法实现。这个方法会返回一个整数,表示指定时间点的小时数。比如,如果我们有一个LocalDateTime对象叫做dateTime,我们可以使用dateTime.getHour()来获取该时间点的小时数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [JAVA基础与高级学习笔记](https://blog.csdn.net/llzqxl/article/details/117363189)[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%"]
- *2* [Java8时间转换(LocalDateTime)代码实例](https://download.csdn.net/download/weixin_38651445/12745153)[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 ]
阅读全文