使用datetimeformatter将date转换为strng
时间: 2024-05-14 12:13:41 浏览: 41
STRNG:随机数生成器的统计测试
Sure, I can help you with that! Here's an example code snippet in Java:
```
LocalDate date = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = date.format(formatter);
System.out.println(formattedDate);
```
This code will get the current date and format it as a string in the format "yyyy-MM-dd". You can change the format to whatever you need. Let me know if you have any more questions!
阅读全文