- Date
Date(); // 得到系统的当前时间
Date(long 1); // 从1970-1-1 08:00:00 开始过了 l 毫秒后的时间
getYear() 1900
getMonth() 1
getDate()
getDay()
getHours()
getMinutes()
getSeconds()
getTime()
set....
- Calender
构造器:
getInstance()
GregorianCalender
字段:
YEAR
MONTH
DATE DAY_OF_MONTH
HOUR HOUR_OF_DAY
MINUTE
SECOND
MILLSECOND
DAY_OF_WEEK
WEEK_OF_MONTH
WEEK_OF_MONTH_IN_YEAR
DAY_OF_YEAR
方法:
get()
set()
isLeapYear(year)
例如:
Calender c=Calender.getInstance();
GregorianCalender gc=new GregorianCalender();
int year=gc.get(c.YEAR);
.....
- DateFormat -- SimpleDateFormat
SimpleDateFormat sdf = new SimplseDateFormat("yyyy年MM月dd日 HH:mm:ss SSSS E");
sdf.format(Date da);
sdf.parse(Stirng s);
- NumberFormat --- DecimalFormat
DecimalFormat df = new DecimalFormat("0000.00"); // "####.##"
df.format(double d);
df.parse(String s);