views:

37

answers:

1

Does there exist a Java class, either in the standard libraries or third party, that allows one to store the date, time in millisecond accuracy and the timezone of the time within the same object?

The features I need:

  • Store a date, time with at least millisecond accuracy and the timezone
  • Parse string date representations (e.g. "2010-07-20T13:22:59.043+0300")
  • Convert the time to system local timezone for display purposes
  • Create a string representation of the date and time
  • Create an object representing the system's current time with the correct timezone information (as provided by the operating system)

What are my options, please? All of the features need not to be stuffed into a single class, but the simpler the better.

+3  A: 

I've heard good things about the Joda Time library, it seems to have a class to fit your needs:

org.joda.time.DateTime

http://joda-time.sourceforge.net/api-release/index.html

fd