java date calendar 有什么区别
怪我咯
怪我咯 2017-04-18 09:50:34
0
2
312

很烦使用java 日期,转换特老火,
有时可用date,有时用calender,
请问你大侠们这个实质区别是什么?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all (2)
阿神

The simple difference is

  • java.util.Dateis a date data

  • java.util.CalendarUsed 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.

    伊谢尔伦

    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.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!