Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GregorianCalendar or just Calendar

Although i read a lot about the calendar and gregoriancalendar, still some complications arise. Which is better or what can you recommend to use? I cant not figure out the difference.

GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance();

or

Calendar c = Calendar.getInstance();

what do you say?

like image 851
Fredrick Gauss Avatar asked Jan 20 '23 02:01

Fredrick Gauss


1 Answers

Calendar is an abstract class, the getInstance method returns one of is implementations depending on the default Locale of your system. This means that if you are using an European or American locale, you'll be using the Gregorian Calendar anyway.

In any case, you should always try to use the Implementation according to the area you are, if the application is in Japan, you may have some problems, because the Japanese calendar is a bit different, for example

You can check it in the Android documentation: here

like image 96
jasalguero Avatar answered Feb 04 '23 17:02

jasalguero