This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSP calendar problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP calendar problem" Watch "JSP calendar problem" New topic

JSP calendar problem

damien farry

Joined: Mar 22, 2001
Posts: 6
i am having problems finding get the weekday of the first day of the current month and the total number of days in the current month to be displayed on a jsp page
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
I think this works, but only tested on current day, so you may want to verify other dates. Calendar and Date don't seem to have a getLastDayOfMonth() or similar, so I coded some stuff. Not really sure if this is the best solution, but it seems to work.

damien farry

Joined: Mar 22, 2001
Posts: 6
got the answer an easier way thanks
ie try to find the length of 'month'
cal.setTime(new Date(year,month+1,day));
wish there was a more direct way to do it, maybe should say something to the lads at Sun
Consider Paul's rocket mass heater.
subject: JSP calendar problem
jQuery in Action, 3rd edition