java

[Java] LocalDateTime format to string, LocalDateTime parse string

moonsiri 2021. 6. 11. 13:39
728x90
반응형

1. LocalDateTime format to string

String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))

 

2. LocalDateTime parse string

LocalDateTime dateTime = LocalDateTime.parse("2021-06-11 13:37:33", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
728x90
반응형