728x90
반응형

LocalDateTime을 문자열로 포맷팅

String formatDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));

System.out.println(formatDate);	// 20230904

 


참고 자료 : https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

 

DateTimeFormatter (Java Platform SE 8 )

Parses the text using this formatter, without resolving the result, intended for advanced use cases. Parsing is implemented as a two-phase operation. First, the text is parsed using the layout defined by the formatter, producing a Map of field to value, a

docs.oracle.com

 

반응형
복사했습니다!