我期待下面的代码在365天前打印今天的日期和日期
public static void main(String[] args) {
long YEAR_IN_MILLIS = 365 * 24 * 60 * 60 * 1000;
Date curDate = new Date();
System.out.println("Todays date: " + curDate);
System.out.println("365 days ago: "
+ new Date(System.currentTimeMillis() - YEAR_IN_MILLIS));
}
然而它打印
Todays date: Tue Jan 12 17:22:19 PST 2016
Date 365 days back: Sat Dec 26 16:41:50 PST 2015
我对以下数学不正确感到惊讶?
long YEAR_IN_MILLIS = 365 * 24 * 60 * 60 * 1000;