LocalDateTime 获取当月的第一天 0点
时间: 2023-10-14 16:00:59 浏览: 249
使用引用中的代码可以获取当前月的第一天0点时间。首先,使用`LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth())`获取当前月的第一天,然后使用`LocalTime.MIN`将时间设置为0点。所以可以使用以下代码获取当月的第一天0点时间:
```
LocalDateTime firstDayOfMonth = LocalDateTime.of(LocalDate.from(LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth())), LocalTime.MIN);
```
<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [LocalDateTime类获取当日00:00与当月第一天](https://blog.csdn.net/qq_41267618/article/details/102914243)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [LocalDateTime 获取当前(年/月)第一天及最后一天 及 获取当天起始时间](https://blog.csdn.net/weixin_55628780/article/details/130527074)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [LocalDateTime获取当日00:00、结束时间23.59与当月第一天00.00,月末最后一天23.59](https://blog.csdn.net/weixin_48174603/article/details/108781167)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文