Hi,
I have dateTime element in a simple XSD. Note with this simple XSD its getting compiled with Castor1.2. Myxsd.xsd ======== <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="purchaseOrder" type="PurchaseOrderType"/> <xsd:element name="comment" type="xsd:string"/> <xsd:complexType name="PurchaseOrderType"> <xsd:sequence> <xsd:element name="itemName" type="xsd:string"/> <xsd:element name="itemQty" type="xsd:string"/> <xsd:element name="orderDate" type="xsd:dateTime"/> </xsd:sequence> </xsd:complexType> </xsd:schema> If I use castor 0.9 and castor 1.2 and try to marshall and unmarshall Iam getting the following. Marshall (with castor 0.9.3) ============================= <?xml version="1.0" encoding="UTF-8"?> <purchase-order-type valid="true"> <order-date>2008-02-29T06:39:28.561</order-date> <item-qty>Two</item-qty><item-name>One</item-name></purchase-order-type> The output comes in local timezone (EST) Marshall (with castor 1.2) =============================== <?xml version="1.0" encoding="UTF-8"?> <purchase-order-type valid="true"> <order-date>2008-02-29T06:39:28.561-05:00</order-date> <item-qty>Two</item-qty><item-name>One</item-name></purchase-order-type> The output comes in local timezone (but it adds -5:00 for GMT) But When I try to UmMarshall Here is the output. UnMarshall (with castor 0.9.2) ================================= L:\work\src>java UnMarshaller UnMarshalled Date Fri Feb 29 06:39:28 EST 2008 UnMarshall (with castor 1.2) ================================= L:\work\src>java UnMarshaller UnMarshalled Date Fri Feb 29 06:39:28 EST 2008 But the output here always comes as EST. What is the purpose of appending (-5.00) with castor 1.2 for dateTime element. I know that I can format this with simpledate formatter but the formatted output is always of String Type. I cant assign it back to order-date. Our Middler tier team wants this value to be only in DateTime type. They want in GMT timezone. Otherwise they face some issues during some calculation. We argued that we will send as String element instead of dateTime for order-date. Which can be Accomplished easily by using simpledate format. But they said with new castor1.2 version This issue is been taken care and no need to send it as String. But for me the output shows no difference between Castor0.9.2 and cator1.2. Ami right ? Where castor1.2 is using that (-5.00) value? I tried to convert this to GMT by following code. Still getting the above format UnMarshaller.java ================= public class UnMarshaller{ public static void main(String args[]){ try{ final TimeZone GMT = TimeZone.getTimeZone("GMT"); Calendar cal = Calendar.getInstance(GMT); FileReader reader = new FileReader("test1.xml"); // Marshal the PO object PurchaseOrderType po= (PurchaseOrderType ) Unmarshaller.unmarshal(PurchaseOrderType.class, reader); cal.setTime(po.getOrderDate()); System.out.println("UnMarshalled Date "+cal.getTime()); }catch(Exception e){ System.out.println("Exception "+e); } } } Is there any way to get the time in GMT format retaining the xsd:dateTime attribute (not as String) ? I had also raised JIRA , http://jira.codehaus.org/browse/CASTOR-2307 Thanks Ravi. ========================================================= The information in this transmission is intended for official use only and may contain information from NJM Insurance Group that is privileged, confidential and exempt from disclosure under applicable law. It is intended for the exclusive use of the persons or entities to which it is addressed. If you are not an intended recipient or the employee or agent responsible for delivering this transmission to an intended recipient, be aware that any disclosure, dissemination, distribution or copying of this communication, or the use of its contents, is strictly prohibited. If you received this transmission in error, please notify the sender by return e-mail and delete the material from any computer. =========================================================