• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calendar class

 
Eric Tan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

thanks




this is my chart.java. where i set and get all the values
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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, )




pascal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic