Java Calendar로 년월일 얻기

Java 2015. 8. 17. 15:11
1
2
3
4
5
6
7
8
9
10
11
12
13
import java.util.Calendar;
 
public class Main {
 
  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    // 
    System.out.println("Current Year is : " + now.get(Calendar.YEAR));
    // month start from 0 to 11
    System.out.println("Current Month is : " + (now.get(Calendar.MONTH) + 1));
    System.out.println("Current Date is : " + now.get(Calendar.DATE));
  }
}
cs





: