Every now and then similar questions pop up. Dates and times seem such a popular subject. I wonder which types to use to represent the date and time in my javabean. Together they form a timestamp, however the date is part of my business key and the time is not, therefore I wanted to separate them. Currently both are represented by a Date, but this seems somewhat strange. Related to this, I have lately heard good things about Joda-time, is this worth using and might this help solving my issue? [ February 17, 2005: Message edited by: Bart Sawyer ]
Originally posted by Bart Sawyer: I have lately heard good things about Joda-time, is this worth using and might this help solving my issue?
Wow, that looks like a really nice and expressive API. I'd say the only downside is al the code that uses java.util.Date. But for a project that makes heavy use of dates and times, it looks pretty sweet.
Originally posted by Tanveer Rameez: Lot of methods of the java.util.Date class has been decrepated. Check the apis for GregorianCalendar. It can be used instead of Date class.
I would venture to say that the GregorianCalendar and Date classes are NOT completely interchangeable. I think deprecating the Date API was an effort to make Date immutable, somewhat like String is. In fact, I've seen the comparison drawn between String and StringBuffer. In many respects Calendar is to Date as StringBuffer is to String.
Besides this still wouldn't solve the OP's problem since Calendar (or its subclasses, like GregorianCalendar) still store the time AND date together as a single entity.