- Java Internationalization Cookbook
- Locales
- Dates and Times
- Calendars
- Gregorian Calendar
- Hebrew Calendar
- Japanese Calendar
- Chinese Calendar
- Find the Chinese zodiac for a Gregorian year
- Get the name of the current month
- Get the first day of the week
- Add time to Calendar
- Get an array of Holidays
- Find the date for the Chinese New Year
- Get all the Era names for the Japanese Calendar
- Get the Japanese era for a Gregorian date
- Formating dates and times
- Calendars
- Numerical Systems
- Misc
- Resource Bundles
- Unicode, Transliteration, and Charactersets
Java Cookbook
Gregorian Calendar
Problem:
You want to create a standard calendar as used in the west.
Solution:
The Gregorian Calendar is the predominant calendar of western countries today. To create a new Gregorian Calendar call the Singleton getInstance method on the Calendar class. if you specify a Locale as an argument the Calendar returned will reflect the first day of the week etc. of the Locale.
Locale locale = new Locale("en","US");
Calendar calendar = Calendar.getInstance(locale);
If you are testing any of these recipes in Eclipse and the characters are not displaying correctly in your console visit http://i18ncookbook.com/eclipse_settings.
This site is ad supported. I hope you find something among our sponsors worth clicking. ;)
i18n search
Custom Search