File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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 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 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:
subject: Calendar class
It's not a secret anymore!