import java.text.SimpleDateFormat;
import java.util.Date;
public class DateTest{
public static void main(String[] args){
Date myDate=new Date(System.currentTimeMillis());
//This time format is your local time format.
System.out.println(myDate.toString());
//Used the simple format to get the String you want .
//The valid string ,you can reference the JDK Doc
SimpleDateFormat sDateFormat=new SimpleDateFormat("yyyy/MM/DD HH:mm:ss");
System.out.println(sDateFormat.format(myDate));
}
}
Date today = new Date();
System.out.println(today);//这个就是今天的时间了
System.out.println(today.getYear());//这个就是今天的年了
System.out.println(today.getDate());//这个就是今天的日期了
..........
public class GregorianCalendar
extends Calendar
GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar used by most of the world.