Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5726

One hour difference after convertToDateTime

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.3
    • Fix Version/s: None
    • Component/s: databinding
    • Labels:
      None

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stefano.ghezzi@icteam.it Stefano Ghezzi
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: