axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shital Joshi (JIRA)" <>
Subject [jira] Created: (AXIS2-3489) Problem with ConverterUtil date conversion
Date Fri, 01 Feb 2008 15:43:09 GMT
Problem with ConverterUtil date conversion

                 Key: AXIS2-3489
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: databinding
    Affects Versions: 1.3
         Environment: Linux OS and Java 5.0
            Reporter: Shital Joshi

When AXIS2 converts Date to String on client side (serialization), it attaches timezone 'Z'
to date (And this is GMT timezone). So when server converts this String to Date (while parsing),
because of GMT timezone (-5 hours from 12 AM), it becomes previous date. 

For example:

java.util.Date d = new SimpleDateFormat("yyyyMMdd").parse("20080124");
System.out.println("d=" + d);
System.out.println("d.toGMTString()=" + d.toGMTString());
String d1 = org.apache.axis2.databinding.utils.ConverterUtil.convertToString(d);
System.out.println("d1=" + d1);
java.util.Date d2 = org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(d1);
System.out.println("d2=" + d2);
System.out.println("d2.toGMTString()=" + d2.toGMTString());

d=Thu Jan 24 00:00:00 EST 2008
d.toGMTString()=24 Jan 2008 05:00:00 GMT
d2=Wed Jan 23 19:00:00 EST 2008
d2.toGMTString()=24 Jan 2008 00:00:00 GMT

This is current implementation of convertToString method in ConverterUtil class.

public static String convertToString(Date value) {
	        // lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz?
	        // we have to serialize it with the GMT timezone
	        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'Z'");
	        return simpleDateFormat.format(value);

The developer should be able to set his own dateformat in this method.

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:
For additional commands, e-mail:

View raw message