Calendar 클래스의 상수

2023. 12. 30. 14:32· LANGUAGE/└ Java

 

 Calendar 클래스추상(abstract)클래스 이기 때문에 아래와 같은 객체 생성이 불가능하다. 

```Calendar c = new Caldendar();```

 Calendar.getInstance() 메소드를 이용하거나 GregorianCalendar 클래스를 상속받아 객체를 생성하여 사용해야 한다. 

 

 

상수 코드 설명
static final int YEAR Calendar.YEAR 연도를 나타냄
Field number for get and set indicating the year.
static final int MONTH Calendar.Month 월을 나타냄
Field number for get and set indicating the month.
static final int DATE Calendar.DATE 일을 나타냄
Field number for get and set indicating the day of the month.
static final int HOUR Calendar.HOUR 시간을 나타냄 (1~12)
Field number for get and set indicating the hour of the morning or afternoon.
static final int HOUR_OF_DAY Calendar.HOUR_OF_DAY 시간을 나타냄 (0~23)
Field number for get and set indicating the hour of the day.
static final int MINUTE Calendar.MINUTE 분을 나타냄
Field number for get and set indicating the minute within the hour.
static final int SECOND Calendar.SECOND 초를 나타냄
Field number for get and set indicating the second within the minute.
static final int WEEK_OF_MONTH  Calendar.WEEK_OF_MONTH 현재 월의 몇 번째 주인지를 나타냄
Field number for get and set indicating the week number within the current month.
static final int WEEK_OF_YEAR Calendar.WEEK_OF_YEAR 한 해의 몇 번째 주인지를 나타냄 
Field number for get and set indicating the week number within the current year.

 

 

 

 

 

더욱 자세한 내용은 아래 링크를 통해 확인할 수 있습니다.

https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Calendar.html#method-summary

728x90