Question of dateFormat in XMLBeans

View: New views
2 Messages — Rating Filter:   Alert me  

Question of dateFormat in XMLBeans

by Vijaya Manne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We are using XML Beans in our application.
 
Our schema uses
 
Here is our schema for datetime:
  <xs:simpleType name="UTCTimestamp">
    <xs:annotation>
      <xs:documentation>String representing Time/date combination represented in UTC (Universal Time Coordinated, also known as “GMT”) in either YYYYMMDD-HH:MM:SS (whole seconds) or YYYYMMDD-HH:MM:SS.sss (milliseconds) format, colons, dash, and period required.  
 Valid values:
 * YYYY = 0000-9999, MM = 01-12, DD = 01-31, HH = 00-23, MM = 00-59, SS = 00-60 (60 only if UTC leap second) (without milliseconds).
 * YYYY = 0000-9999, MM = 01-12, DD = 01-31, HH = 00-23, MM = 00-59, SS = 00-60 (60 only if UTC leap second), sss=000-999 (indicating milliseconds).
Leap Seconds:  Note that UTC includes corrections for leap seconds, which are inserted to account for slowing of the rotation of the earth. Leap second insertion is declared by the International Earth Rotation Service (IERS) and has, since 1972, only occurred on the night of Dec. 31 or Jun 30. The IERS considers March 31 and September 30 as secondary dates for leap second insertion, but has never utilized these dates. During a leap second insertion, a UTCTimestamp field may read "19981231-23:59:59", "19981231-23:59:60", "19990101-00:00:00".  (see http://tycho.usno.navy.mil/leapsec.html)
</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:dateTime" />
  </xs:simpleType>
 
  <xs:simpleType name="TransactTime_t">
    <xs:annotation>
      <xs:documentation xml:lang="en">
      Time of execution/order creation (expressed in UTC (Universal Time Coordinated, also known as "GMT")
    </xs:documentation>
      <xs:appinfo>
        <fm:Xref Protocol="FIX" name="TransactTime" tag="60" datatype="UTCTimestamp" ComponentType="Field" StdAbbrev="TxnTm" Category="" CategoryAbbrev="" />
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="UTCTimestamp" />
  </xs:simpleType>
I believe that internally it uses XmlCalender class to set the value for transaction time.
 
Here is my implementation:
   public void setTransactionTime(Calendar transactionTime)
   {
      if (transactionTime != null)
      {
         transactionTime.clear(Calendar.MILLISECOND);
         _message.setTxnTm(transactionTime);
      }
      else if ( _message.isSetTxnTm() )
      {
         _message.unsetTxnTm();
      }
   }
We need this field in the format of 2008-06-30T13:26:20-0500
 
But I am getting the value in the format of 2008-06-30T13:26:20-05:00
 
I would like to remove colon (:) from timezone difference.
 
Does any body have any idea how to get datetime field in custom format?

Thanks

Vijaya Manne
IntercontinentalExchange | ICE
2100 RiverEdge Pkwy | 5th Floor | Atlanta, GA 30328
Tel: 770.857.0371
vijaya.manne@...

Production Issues Logging
https://www.theice.com/integrate

24-hour ice helpdesk 770.738.2101
http://www.theice.com
 
 

This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


Re: Question of dateFormat in XMLBeans

by peter_van_de_water :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


If you are talking about Java then use the SimpleDateFormat class to format. If you are talking about W3 Schema then it only accepts the "colon" date format. If you need it without you would need to store it in an xs:string with regular expression restriction rather than a xs:dateTime. If need be you can massage it from one to the other in XSL.

Pete


PETE VAN DE WATER

Java Developer
VTech - Business Technology New Zealand
Vero Insurance New Zealand Limited
p
+64 9 363 2518
x
632 518
m
+64 21 226 6228
e
peter_van_de_water@...

www.vero.co.nz




"Vijaya Manne" <Vijaya.Surapaneni@...>

01/07/2008 05:28 a.m.
Please respond to
dev@...

To
<dev@...>
cc
Subject
Question of dateFormat in XMLBeans





We are using XML Beans in our application.
 
Our schema uses
 
Here is our schema for datetime:
  <xs:simpleType name="UTCTimestamp">
   <xs:annotation>
     <xs:documentation>String representing Time/date combination represented in UTC (Universal Time Coordinated, also known as “GMT”) in either YYYYMMDD-HH:MM:SS (whole seconds) or YYYYMMDD-HH:MM:SS.sss (milliseconds) format, colons, dash, and period required.  
Valid values:
* YYYY = 0000-9999, MM = 01-12, DD = 01-31, HH = 00-23, MM = 00-59, SS = 00-60 (60 only if UTC leap second) (without milliseconds).
* YYYY = 0000-9999, MM = 01-12, DD = 01-31, HH = 00-23, MM = 00-59, SS = 00-60 (60 only if UTC leap second), sss=000-999 (indicating milliseconds).
Leap Seconds:  Note that UTC includes corrections for leap seconds, which are inserted to account for slowing of the rotation of the earth. Leap second insertion is declared by the International Earth Rotation Service (IERS) and has, since 1972, only occurred on the night of Dec. 31 or Jun 30. The IERS considers March 31 and September 30 as secondary dates for leap second insertion, but has never utilized these dates. During a leap second insertion, a UTCTimestamp field may read "19981231-23:59:59", "19981231-23:59:60", "19990101-00:00:00".  (see
http://tycho.usno.navy.mil/leapsec.html)
</xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:dateTime" />
 </xs:simpleType>

 
  <xs:simpleType name="TransactTime_t">
   <xs:annotation>
     <xs:documentation xml:lang="en">
     Time of execution/order creation (expressed in UTC (Universal Time Coordinated, also known as "GMT")
   </xs:documentation>
     <xs:appinfo>
       <fm:Xref Protocol="FIX" name="TransactTime" tag="60" datatype="UTCTimestamp" ComponentType="Field" StdAbbrev="TxnTm" Category="" CategoryAbbrev="" />
     </xs:appinfo>
   </xs:annotation>
   <xs:restriction base="UTCTimestamp" />
 </xs:simpleType>

I believe that internally it uses XmlCalender class to set the value for transaction time.
 
Here is my implementation:
   public void setTransactionTime(Calendar transactionTime)
  {
     if (transactionTime != null)
     {
        transactionTime.clear(Calendar.MILLISECOND);
        _message.setTxnTm(transactionTime);
     }
     else if ( _message.isSetTxnTm() )
     {
        _message.unsetTxnTm();
     }
  }

We need this field in the format of 2008-06-30T13:26:20-0500
 
But I am getting the value in the format of 2008-06-30T13:26:20-05:00
 
I would like to remove colon (:) from timezone difference.
 
Does any body have any idea how to get datetime field in custom format?

Thanks

Vijaya Manne
IntercontinentalExchange | ICE
2100 RiverEdge Pkwy | 5th Floor | Atlanta, GA 30328
Tel: 770.857.0371

vijaya.manne@...

Production Issues Logging
https://www.theice.com/integrate

24-hour ice helpdesk 770.738.2101

http://www.theice.com
 
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


The following message has been automatically added by the Internet mail gateway to comply with the Group's Information Security requirements.

"This e-mail has arrived via the Internet, and therefore you should be cautious about its origin and content. Replies which contain sensitive information and / or legal/contractual obligations are particularly vulnerable.

In these cases you should not reply unless you are authorised to do so, and adequate encryption is employed."

If you have any questions, please contact the IS Service Desk.


**********************************************************************
CAUTION - This message is intended for the addressee named above. It may contain privileged or confidential information.

If you are not the intended recipient of this message you must:
- Not use, copy, distribute or disclose it to anyone other than the addressee;
- Notify the sender via return email; and
- Delete the message (and any related attachments) from your computer immediately.

Internet emails are not necessarily secure. Vero Insurance New Zealand Limited (Vero), and its related entities, do not accept responsibility for changes made to this message after it was sent.

Unless otherwise stated, views expressed within this email are the author's own and do not represent those of Vero.

If you do not wish to receive any more emails from this person or Vero please respond to this email with the word "unsubscribe" in the subject field.
**********************************************************************

LightInTheBox - Buy quality products at wholesale price