• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Working with Calendar class

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Experts,
I have the following code where I am creating a table on a jsp page. First Column of the table is "Application" and after that 12 months.
My problem is that, First month is coming up as April, Where as I want to start from july as first month and last month as June.
Can somone please tell me where do I need to do modification in my current code.

 
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I'm not 100% sure here but doesn't the following code just return today's date 12 times. This month is April so that's why you are getting April. If you always want to start with June then why even get the current date? Just get a Date object with the month of June or turn your current date's month to June. The month is an int and you know how to roll it so the rest should be easy



HTH
 
Aman Singh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian,
Thanks for your quick reply. Actually you are correct with the return of 12 dates, but later on I am formatting it in month.
what I am trying to achieve is:
* maintain the headers Dynamic is way that, Lets say July is first month and June is last in the table.
so when we move on to May 2009, August would be the first month and July as last.

I hope I explained it correct :-(
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Aman Singh wrote:Hi Brian,
Thanks for your quick reply. Actually you are correct with the return of 12 dates, but later on I am formatting it in month.
what I am trying to achieve is:
* maintain the headers Dynamic is way that, Lets say July is first month and June is last in the table.
so when we move on to May 2009, August would be the first month and July as last.

I hope I explained it correct :-(




Whats the logic behind that , current month + 3 ? then implement that using Calendar set() method
 
    Bookmark Topic Watch Topic
  • New Topic