Getting current datetime using Calendar.getInstance() vs new GregorianCalendar()

后端 未结 2 360
忘了有多久
忘了有多久 2021-02-01 01:30

What might be the difference between getting datetime using

Calendar.getInstance()

vs

new GregorianCalendar()

?

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 02:11

    Calendar.getInstance() will give you a Calendar using the default time zone and locale, which can result in a GregorianCalendar, a BuddhistCalendar, or a JapaneseImperialCalendar.

    GregorianCalendar will always give you, well, a Gregorian calendar.

提交回复
热议问题