很烦使用java 日期,转换特老火,
有时可用date,有时用calender,
请问你大侠们这个实质区别是什么?
阿神2017-04-18 09:52:34
The simple difference is
java.util.Date
is a date data
java.util.Calendar
Used for date related calculations
In addition, if you can’t find the function you need in Date, go to Calendar and find it. You will know which one can do what.
伊谢尔伦2017-04-18 09:52:34
Although I don’t know, it’s quite interesting. The current usage of the Date class is generally to treat the date as a whole to perform some operations, such as Format, and Calendar seems to be specially designed to subdivide Date. Date's getXXX is now Deprecated, and the doc clearly states that You use the method corresponding to Calendar, and it feels like Calendar is designed to make up for Date design flaws or something.