• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

JSP calendar problem

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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
 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

HTH
 
damien farry
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
got the answer an easier way thanks
ie try to find the length of 'month'
cal.setTime(new Date(year,month+1,day));
cal.add(Calendar.DATE,-1);
cal.get(Calendar.DAY_OF_MONTH);
wish there was a more direct way to do it, maybe should say something to the lads at Sun
Thanks
Damien
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic