package joeho.net.csdn.blog;
import java.util.*;
import java.text.SimpleDateFormat;
public class TestCalendar {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
Calendar c = Calendar.getInstance();
System.out.println(c.get(c.YEAR)+"年"+c.get(c.MONTH)+"月"+c.get(c.DAY_OF_MONTH)+"日 "+c.get(c.HOUR)+":"+c.get(c.MINUTE)
+":"+c.get(c.SECOND));
c.add(c.DAY_OF_YEAR,360);
System.out.println(c.get(c.YEAR)+"年"+c.get(c.MONTH)+"月"+c.get(c.DAY_OF_MONTH)+"日 "+c.get(c.HOUR)+":"+c.get(c.MINUTE)
+":"+c.get(c.SECOND));
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
try{
Date tt = sd.parse("2009-01-18");
System.out.println(sd.format(tt));
}catch(Exception e){e.printStackTrace();}
}
}