1.Date类的核心是 long 类型的数值,Date类中getTime方法的源码如下:
/**
* Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by this <tt>Date</tt> object.
*
* @return the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by this date.
*/
public long getTime() {
return getTimeImpl();
}
* Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by this <tt>Date</tt> object.
*
* @return the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by this date.
*/
public long getTime() {
return getTimeImpl();
}
2.Calendar是一个抽象类,声明了日历的相关操作,如
set(field,value),add(field.value),getActualMaximum(field)等方法。
3.DateFormat也是抽象类,声明了日期和字符串相互转换的操作。