Java SE 8부터 지원하는 새롭게 재 디자인한 패키지
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
LocalDateTime timePoint = LocalDateTime.now();
LocalDate ld = LocalDate.of(2022, Month.MAY, 10);
LocalTime lt1 = LocalTime.of(15, 50);
LocalTime lt2 = LocalTime.parse("13:10:30");
System.out.println(timePoint);
System.out.println(ld);
System.out.println(lt1);
System.out.println(lt2);
출력값
2022-01-26T14:16:53.701210
2022-05-10
15:50
13:10:30
LocalDateTime timePoint = LocalDateTime.now();
LocalDate theDate = timePoint.toLocalDate();
System.out.println(theDate);
Month month = timePoint.getMonth();
int day = timePoint.getDayOfMonth();
int hour = timePoint.getHour();
int minute = timePoint.getMinute();
int second = timePoint.getSecond();
System.out.println(month.getValue() + "/" + day + " " + hour + ":" + minute + ":" + second);
출력값
2022-01-26
1/26 14:19:22