๋ฐ์ํ date1 [JAVA] ๋ ์ง ๋น๊ต ํ๊ธฐ (Date, LocalDateTime, LocalDate) 1. java.util.Date์๋ ๋ ์ง๋ฅผ ๋น๊ตํ ์ ์๋ ๋ฉ์๋๊ฐ ๋๊ฐ์ง ์๋ค. after, before ์ฌ์ฉ - before: ์ธ์๋ณด๋ค ๊ณผ๊ฑฐ์ผ ๋ true - after: ์ธ์๋ณด๋ค ๋ฏธ๋์ผ ๋ true - equal: ์ธ์์ ๊ฐ์ ๋ true public void compareDate(Date date1, Date date2){ if(date1.after(date2)){ System.out.println("Date1 > Date2"); } if(date1.before(date2)){ System.out.println("Date1 < Date2"); } if(date1.equals(date2)){ System.out.println("Date1 = Date2"); } } compareTo ์ฌ์ฉ - comp.. 2021. 12. 21. ์ด์ 1 ๋ค์ 728x90 ๋ฐ์ํ