wood burning stoves
The moose likes Java in General and the fly likes Calendar class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calendar class" Watch "Calendar class" New topic

Calendar class

Eric Tan
Ranch Hand

Joined: Oct 11, 2006
Posts: 72
This is one part of my coding to generate a Gantt Chart.
the problem is how can i convert from my chart.java that i kept the month integer to be put into the calendar in this codes below. as you can see that i retrieve from chart class the start day and the year also. but the calendar, i am not sure how. can anyone guide me on this?


this is my chart.java. where i set and get all the values
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
I would sugest to keep the day/year/hour fields in a java.util.Date object and not as separate fields.

Then you can use a java.util.Calendate to retrieve the values (be careful and check where the index starts (e.g. does day = 1 mean it's the first day of a month or is it already the second day because index starts at 0). Take a look at the get() method and the constants defined by Calendar class (e.g. DATE, DAY_oF_WEEK, )

I agree. Here's the link: http://aspose.com/file-tools
subject: Calendar class
It's not a secret anymore!