dcsimg
months of the year
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Harry_Papas
Posted On:   Monday, January 12, 2004 07:56 PM

Hi,

I need to be able to obtain a list of years, months and days for a given year range. The problem is that not all countries have the same number of months for every year (eg one country has 13 months for leap years). Taking this into account, I want to obtain the number of months contained in a certain year for a certain local, and iterate through these months. I have had a look at SimpleDateFormat, which does the localization, but i can't find how to get the number of months for a particular year.
Does anybody know how to do this. If so, could you please email me at hazman31@hotmail.com.
Thanks

Harry

Re: months of the year

Posted By:   Hendrik_Schreiber  
Posted On:   Monday, February 2, 2004 06:45 AM

Take a look at java.util.Calendar and the add() method.

Re: months of the year

Posted By:   Thomas_Hackel  
Posted On:   Tuesday, January 13, 2004 02:44 AM

Hi!

Use the Calendar class. Calendar.getInstance(_LOCALE_) returns a calendar usable for this locale (for all western calendars this will be GregorianCalendar). If you need a very special calendar (13 months a year, never heard of this) you have to implement it. But in general an implementation of Calendar has all needed functions for calendar manipulation. And i suggest follow this rule: only use the static variables to check things (weekday 0 is not allways monday, so check for MONDAY).
The implemented GregorianCalendar is powerful and did allways satisfied my needs...
About | Sitemap | Contact