0

I would like to save the date that I chose with JCalendar in 3 variables. One for the day, month, and year. How is this possible, and how could I do it? I created my code with a JFrame in Netbeans, and with the design tools.

troy_frommer
  • 102
  • 1
  • 21
NickName
  • 313
  • 2
  • 9
  • 25
  • 1
    ... Why in three separate variables? That's going to make it hard to work with (ie - do you know the formula for leap years?). You'd be better off using a 'date' type, preferably something like the excellent [JodaTime](http://joda-time.sourceforge.net/) library (because the standard JDK one sucks). – Clockwork-Muse Jul 16 '13 at 18:50
  • I would like to take for different classes only the day and year. It's just my program. So i want to save it in 3 variables or to save it in one variable and seperate it after that. – NickName Jul 16 '13 at 21:00
  • JodaTime supports a number of different composite fields. Really, the best thing to do in general is keep it as a date/time/timestamp type, then just translate/format it at display time. This is especially important when dealing with an international context, where formatting changes often. – Clockwork-Muse Jul 16 '13 at 21:05
  • I used JCalendar because i could create a diplay calendar to choose the date you want. So after this selection i just want to seperate it. I don't know if this is possible and how at JodaTime. – NickName Jul 16 '13 at 21:11

0 Answers0