File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Working with Calendar class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Working with Calendar class" Watch "Working with Calendar class" New topic
Author

Working with Calendar class

Aman Singh
Ranch Hand

Joined: Oct 30, 2008
Posts: 57
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.

Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
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


SCJA
~Currently preparing for SCJP6
Aman Singh
Ranch Hand

Joined: Oct 30, 2008
Posts: 57
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 :-(
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Working with Calendar class