java LocalDateTime 30分整点
时间: 2023-10-14 11:04:33 浏览: 88
要获取Java LocalDateTime的30分整点,可以使用LocalDateTime的withMinute()方法。你可以先获取当前的LocalDateTime实例,然后使用withMinute()方法将分钟设置为30。下面是一个示例代码:
LocalDateTime now = LocalDateTime.now();
LocalDateTime thirtyMinutes = now.withMinute(30);
这样,变量thirtyMinutes将包含当前时间的30分整点的LocalDateTime实例。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [LocalDateTime根据当前时间获取 下一个整点和下一个整点+2h 的 时间段](https://blog.csdn.net/weixin_35025310/article/details/114453905)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Java8-LocalDateTime&LocalDate](https://blog.csdn.net/weixin_44823155/article/details/128151905)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文