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

Jack Bush netbeansfan at yahoo.com.au
Wed Aug 18 00:54:46 PDT 2010

Thank you to both Jason & Tatu,

Below is an attempt which I haven't yet being able to verify even though it has 
been deployed in EJB 3.0 (Glassfish 2.1) container:

    org.jdom.Element collectionDateTime = 
    SimpleDateFormat collection_date_formatter = new 
    Date collection_date_parsed = 

    SimpleDateFormat collection_time_formatter = new SimpleDateFormat("hh:mm:ss 
    Date collection_time_parsed = 

I am awaiting to test out the JPA persistent once the 
"java.io.UTFDataFormatException" issue is resolved.

Thanks again,

----- Original Message ----
From: Tatu Saloranta <cowtowncoder at yahoo.com>
To: Jack Bush <netbeansfan at yahoo.com.au>; Jason Hunter <jhunter at servlets.com>
Cc: jdom-interest at jdom.org
Sent: Tue, 17 August, 2010 5:03:14 AM
Subject: Re: [jdom-interest] Fw: How to date type conversion between xml and 

--- 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 
> 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