localdatetime转为年月日
时间: 2023-08-22 21:09:07 浏览: 175
要将LocalDateTime转换为年月日,可以使用LocalDateTime的toLocalDate()方法。这将返回一个LocalDate对象,其中包含了年、月和日的信息。例如:
LocalDateTime localDateTime = LocalDateTime.now();
LocalDate localDate = localDateTime.toLocalDate();
现在,localDate对象中包含了localDateTime的年、月和日信息,可以使用localDate对象进行进一步的操作或格式化。
#### 引用[.reference_title]
- *1* *2* [localdate](https://blog.csdn.net/weixin_45817985/article/details/126261797)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [LocalDateTime、LocalDate、Date的相互转换](https://blog.csdn.net/weixin_39612554/article/details/112865490)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文