[
https://issues.apache.org/jira/browse/AXIS2-3414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rob Decker updated AXIS2-3414:
------------------------------
ConverterUtil is interpreting the 'decimal fraction of a second' (see below) as
number of milliseconds.
http://www.w3.org/TR/NOTE-datetime
The formats are as follows. Exactly the components shown here must be present,
with exactly this punctuation. Note that the "T" appears literally in the
string, to indicate the beginning of the time element, as specified in ISO
8601.
Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a
second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
where:
YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)
s = one or more digits representing a decimal fraction of a second
TZD = time zone designator (Z or +hh:mm or -hh:mm)
> XML dateTime strings are not converted correctly
> ------------------------------------------------
>
> Key: AXIS2-3414
> URL: https://issues.apache.org/jira/browse/AXIS2-3414
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: databinding
> Affects Versions: 1.3
> Environment: Java 1.5.0_11 Axis2 1.3
> Reporter: Rob Decker
>
> XML dateTime strings are not converted correctlly:
> {code}
> import javax.xml.datatype.DatatypeConfigurationException;
> import javax.xml.datatype.DatatypeFactory;
> import javax.xml.datatype.XMLGregorianCalendar;
> import org.apache.axis2.databinding.utils.ConverterUtil;
> public class Axis2DateTimeBug {
> public static void main(String[] args) {
> String tin = "2007-12-20T18:36:29.6102028Z";
> String tout = "2007-12-20T20:18:11.028Z";
> System.out.println("Axis2 converts "+tin+" to Java Date:
> "+ConverterUtil.convertToDateTime(tin).getTime());
> System.out.println("Axis2 converts "+tout+" to Java Date:
> "+ConverterUtil.convertToDateTime(tout).getTime());
> System.out.println("Axis2 converts "+tin+" to dateTime:
> "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tin).getTime()));
> System.out.println("Axis2 converts "+tout+" to dateTime:
> "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tout).getTime()));
>
> try {
> DatatypeFactory dtf = DatatypeFactory.newInstance();
> XMLGregorianCalendar calin =
> dtf.newXMLGregorianCalendar(tin);
> System.out.println("XMLGC converts "+tin+" to XML
> Format: "+calin.toXMLFormat()+" to Java Date:
> "+calin.toGregorianCalendar().getTime());
> XMLGregorianCalendar calout =
> dtf.newXMLGregorianCalendar(tout);
> System.out.println("XMLGC converts "+tout+" to XML
> Format: "+calout.toXMLFormat()+" to Java Date:
> "+calout.toGregorianCalendar().getTime());
> } catch (DatatypeConfigurationException e) {
> e.printStackTrace(System.err);
> }
> }
> {code}
> Axis2 converts 2007-12-20T18:36:29.6102028Z to Java Date: Thu Dec 20 15:18:11
> EST 2007
> Axis2 converts 2007-12-20T20:18:11.028Z to Java Date: Thu Dec 20 15:18:11 EST
> 2007
> Axis2 converts 2007-12-20T18:36:29.6102028Z to dateTime: 2007-12-20Z
> Axis2 converts 2007-12-20T20:18:11.028Z to dateTime: 2007-12-20Z
> XMLGC converts 2007-12-20T18:36:29.6102028Z to XML Format:
> 2007-12-20T18:36:29.6102028Z to Java Date: Thu Dec 20 13:36:29 EST 2007
> XMLGC converts 2007-12-20T20:18:11.028Z to XML Format:
> 2007-12-20T20:18:11.028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]