Should I use GregorianCalendar or Date for a birthday field?
-
16-03-2021 - |
Question
I'm a little bit confused about using the class GregorianCalendar
and Date
.
What is the difference?
For instance: I have a field in a Person object that represents the date he was born.
Do I have to use Date
or GregorianCalendar
?
What is the best use for them?
OTHER TIPS
I would use Date to represent the date of birth. Use Calendar (and child classes) to manipulate dates.
Both Date and Calendar classes suffer from poor APIs. You should use the Joda Time library instead.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow