오늘 날짜 얻어 내기

2024. 11. 7. 22:39Java

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class DateExample {
    public static void main(String[] args) {
        LocalDate today = LocalDate.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        String formattedDate = today.format(formatter);

        System.out.println("Today's date in yyyymmdd format: " + formattedDate);
    }
}