first day of the month
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   maha_devan
Posted On:   Thursday, December 20, 2001 01:32 AM

how can i find the first day of the month. pls help me out folks

Re: first day of the month

Posted By:   Anonymous  
Posted On:   Thursday, December 20, 2001 01:44 AM

I think you want to discover the week day (Sunday, Monday, etc.) for the first day of the month.

I don't think there is any method for doing that, but I would solve this issue this way:

Calendar cal = new GregorianCalendar();
cal.add(Calendar.DATE, -(cal.get(Calendar.DAY_OF_MONTH)-1)); // cal now contains the first day of the month

int weekDay = cal.get(Calendar.DAY_OF_WEEK);
Date firstDayOfMonth = cal.getTime();

Regards
About | Sitemap | Contact