Date
看了下Date里的东西,记录下
public Date(int year, int month, int date, int hrs, int min, int sec) {
int y = year + 1900;
// month is 0-based. So we have to normalize month to support Long.MAX_VALUE.
if (month >= 12) {
y += month / 12;
month %= 12;
} else if (month < 0) {
y += CalendarUtils.floorDivide(month, 12);
month = CalendarUtils.mod(month, 12);
}
BaseCalendar cal = getCalendarSystem(y);
cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef());
cdate.setNormalizedDate(y, month + 1, date).setTimeOfDay(hrs, min, sec, 0);
getTimeImpl();
cdate = null;
}
* @param year the year minus 1900.
* @param month the month between 0-11.
* @param date the day of the month between 1-31.
* @param hrs the hours between 0-23.
* @param min the minutes between 0-59.
* @param sec the seconds between 0-59.
* @return the number of milliseconds since January 1, 1970, 00:00:00 GMT for
* the date and time specified by the arguments.
额,在别的地方看到说现在这个方法被废弃了。
还是记录下吧= =!
本文深入解析Java中Date类的构造方法,特别是带有6个参数的构造函数,详细说明了如何通过年、月、日、小时、分钟和秒来创建日期时间对象。同时,文章提到了该方法已被标记为废弃,但仍提供了详细的实现过程供读者参考。
4743

被折叠的 条评论
为什么被折叠?



