File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes UTC format date in XML- Help!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "UTC format date in XML- Help!!" Watch "UTC format date in XML- Help!!" New topic
Author

UTC format date in XML- Help!!

maoushuk Imran
Greenhorn

Joined: Jul 01, 2009
Posts: 6
I have to set the date in UTC to the xml beans which in turn to be sent to other platform through webservices. I am using
objCal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
for the objCal i am setting my date
objCal .setTime(objDocHeaderBean.getCreationDate());
if i print the date i am getting the date in required format ie Wed Jul 01 12:39:25 GMT 2009 but after setting it to xmlbeans the format is not same i am getting 2009-07-01T00:00:00.000+00:00. But iwant my previous format to be sent. I tried a lot . Can anyone help on this???
maoushuk Imran
Greenhorn

Joined: Jul 01, 2009
Posts: 6
Please help on this. I ve to finish it by tomorrow. Am trying for the past 2 days.
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 357
Hi Maoshuk,
the latter format seems to be the correst XSD format and is probably the correct format to be sent through xml web services.

To get the the format you prefer you may have to use a calendar and format the date at the other end.

Also it would help if you could describe "why" you want that particular format to be sent in xml.
maoushuk Imran
Greenhorn

Joined: Jul 01, 2009
Posts: 6
Latter format is one which the end user wants ie that is the format the service requestor needs while sending through webservices
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 357
I am not familiar with xmlbeans. But I guess you use an xml schema to generate some java xml beans?

Then may be a modification to the schema "if possible" to change the xsd data type from date/time to string may have a probability of working.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: UTC format date in XML- Help!!