You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Stefano Ghezzi (JIRA)" <ji...@apache.org> on 2015/10/12 17:07:05 UTC

[jira] [Created] (AXIS2-5726) One hour difference after convertToDateTime

Stefano Ghezzi created AXIS2-5726:
-------------------------------------

             Summary: One hour difference after convertToDateTime
                 Key: AXIS2-5726
                 URL: https://issues.apache.org/jira/browse/AXIS2-5726
             Project: Axis2
          Issue Type: Bug
          Components: databinding
    Affects Versions: 1.6.3
            Reporter: Stefano Ghezzi


I find a difference of one hour between the date coming from the client and the date returned by the axis2 system.
Debugging inside the code i get to the method 

org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime

which seems responsible of the conversion from string to date

This is the snipped from the ws call

<D_ULT_AGGM>2015-07-03T09:58:37</D_ULT_AGGM>

The field was declared as dateTime

          <s:element minOccurs="1" maxOccurs="1" name="D_ULT_AGGM" type="s:dateTime" />


This is the test program

package test;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Axis2DateBug {

        public static void main(String[] args) {

            String date = "2015-07-03T09:58:37";
            Calendar cal = org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(date);
            Date d = cal.getTime();
            SimpleDateFormat itaDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");

            System.out.println("prev=" + date);
            System.out.println(" new="+itaDateFormat.format(d));

            // result
            //prev=2015-07-03T09:58:37
            // new=2015-07-03T10:58:37

        }
}

The output date has an hour gain from the original hour. I suspect this could be related to timezone but i can't understand how to overcome the problem. Is this an axis2 bug of there is something i could do to get out the correct date?

Thanks in advance



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org