Java versus ISO 8601 and RFC 2822 date formats

You'd think a language like Java, born during the popularization of the Internet and originally positioned as a language for writing code to be run straight off the Internet would have better support for Internet standard date and time formats. I know date and time handling is complicated, and I'm very glad someone other than me had to write all those classes, but I wish they'd given them a simple interface for people who just don't care.

The only time format that's really easy to work with in Java is raw milliseconds, which is just weird. It's not totally insane for a program to output something like "took 109ms", but it's habit-forming, and before you know it your programs are saying things like "uptime 823475ms" too. Which is silly.

I wish they'd focused on globalization as much as they did on localization. Who cares about locale-specific date formatting when we have ISO 8601?

The only mentions of ISO 8601 I could find in the JDK are in java.util.GregorianCalendar and java.util.logging.XMLFormatter; the former having a comment saying that it uses the same interpretation of week numbers, the latter a private method for appending the time and date (as a long) to a StringBuffer. I found no references to RFC 2822.

The ISO 8601 representation of 823475ms, by the way, is P13M43.475S. It's weird the first time you see it (especially with the upper-case letters; according to section 5.1.2 of the standard, the 'P' stands for 'period') but you get used to it. And it's a lot easier to work out that that's 13 minutes 43 seconds than do anything with 823475ms.

Oh well. My library of useful Java stuff (available from my home page in conjunction with Edit or SCM) just gained a class.