[jdom-interest] Fw: How to date type conversion between xml and Java

Tatu Saloranta cowtowncoder at yahoo.com
Mon Aug 16 12:03:14 PDT 2010


--- On Sun, 8/15/10, Jason Hunter <jhunter at servlets.com> wrote:

> From: Jason Hunter <jhunter at servlets.com>
> Subject: Re: [jdom-interest] Fw: How to date type conversion between xml and Java
> To: "Jack Bush" <netbeansfan at yahoo.com.au>
...
> Use java.text.SimpleDateFormat. 
> It can parse the date string, lets you interact with it as
> data, and helps you reformat it if you need.
> 
> Note it's relatively slow because of its complex
> internals.  If your dates are always in the exact same
> simple format like you showed, and you need to parse a huge
> number of them, a simple custom parser based on character
> positions can be much faster.

Also, might want to consider Joda library, which is an improvement over JDK defaults, both in functionality and (I think) with respect to efficiency. Can usually just construct DateTime out of typical (ISO-8601) date Strings.

-+ Tatu +-




      



More information about the jdom-interest mailing list