[Advanced-java] xs:dateTime

Dennis Sosnoski dms at sosnoski.com
Fri May 2 10:26:15 2003


You can come close using SimpleDateFormat, but I don't think you can 
really match it 100 percent. One alternative is using code from my JiBX 
project at http://www.jibx.org. The org.jibx.runtime.Utility class has 
full support for converting xs:dateTime to and from Java Date instances.

Source is in the download, or you can get this class directly from CVS 
at 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jibx/jibx/build/src/org/jibx/runtime/Utility.java 
The coversion to a String is the serializeDateTime method, the coversion 
from String is the parseDateTime method. The code is BSD licensed so you 
use it pretty freely.

  - Dennis

Antonello Dell'Armi wrote:

>How can i create a java String with the same syntax of  "xs:dateTime" of xml type?
>Is it possible or should i use concatenation of strings?
> 
>BRGS
>@nto
> 
>
>  
>