File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes AXIS date issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "AXIS date issue" Watch "AXIS date issue" New topic
Author

AXIS date issue

Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,
DOes AXIS automatically converts the date in GMT TimeZone and send accross at the time of hitting web service?

AMit


SCJP,SCWCD,SCBCD,SCDJWS1.4, SCDJWS1.5
Ashutosh Shahi
Ranch Hand

Joined: Feb 06, 2005
Posts: 36
Yep,
dateTime is always sent in GMT Timezone over the wire

Once you receive the dateTime in a java.util.Calendar, doing:
calendar.setTimeZone(java.util.TimeZone.getDefault());
gives back the date to u according to your current localization settings.

Ashutosh


<a href="http://blogs.sun.com/roller/page/ashutosh" target="_blank" rel="nofollow">http://blogs.sun.com/roller/page/ashutosh</a>
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi Ashutosh,
Thanks for your reply but chnages suggested by you are at the receiving hand of Web Service.
Can you send me the link where it says datetime/Calendar is always send across in GMT?

Amit
Kuldeep Vaishnav
Ranch Hand

Joined: May 23, 2004
Posts: 72
yes i think what Ashutosh is saying is correct.we had a similar problem between java layer and db2 few days ago with sql date.One suggestion is to write a util method which sets the date to GMT noon and then use the method at each end point before sending the data.The date and hrs will not change.hope this helps.somethin like followin........

public static java.sql.Date getGMTNoon( java.util.Date dt)
{
XYZCalendar cal = new XYZCalendar(dt.getTime());
cal.setGMTNoon();
return cal.getSqlDate();
}

u can change the date type to suit ur needs.


Kuldeep
Kuldeep Vaishnav
Ranch Hand

Joined: May 23, 2004
Posts: 72
sorry...XYZCalendar is a custom class which extends java.Calendar...but u can use java calendar directly too...
Ashutosh Shahi
Ranch Hand

Joined: Feb 06, 2005
Posts: 36
Amit,
I don't have a link, but I have confirmed it. And its pretty logical stuff to do, coz ur webservice can be anywhere in world, and can be accessed from anywhere, so obviously it can't assume what timezone is used rather than using something standard. If its not doing that, then the webservice has a bug.
Ashutosh
 
GeeCON Prague 2014
 
subject: AXIS date issue