[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    Re: Question of dateFormat in XMLBeans
From:       peter_van_de_water () vero ! co ! nz
Date:       2008-06-30 20:30:49
Message-ID: OF80E1BBFC.1A771EA8-ONCC257478.006FCDD2-CC257478.0070AF81 () promina ! com ! au
[Download RAW message or body]

--=_related 0070AF80CC257478_Content-Type: multipart/alternative; \
boundary="=_alternative 0070AF80CC257478_="


--=_alternative 0070AF80CC257478_Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="ISO-8859-1"

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@vero.co.nz
www.vero.co.nz





"Vijaya Manne" <Vijaya.Surapaneni@theice.com> 
01/07/2008 05:28 a.m.
Please respond to
dev@xmlbeans.apache.org


To
<dev@xmlbeans.apache.org>
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@theice.com

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.
**********************************************************************
--=_alternative 0070AF80CC257478_Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="ISO-8859-1"


<br><font size=2 face="sans-serif">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 &quot;colon&quot; 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.</font>
<br>
<br><font size=2 face="sans-serif">Pete<br>
<br>
</font><font size=1 color=red face="Verdana"><b><br>
PETE VAN DE WATER</b></font><font size=1 color=#666666 face="Verdana"><b><br>
Java Developer<br>
VTech - Business Technology New Zealand<br>
Vero Insurance New Zealand Limited<br>
p </b>+64 9 363 2518<b><br>
x </b>632 518<b><br>
m </b>+64 21 226 6228<b><br>
e </b>peter_van_de_water@vero.co.nz</font><font size=1 color=red face="Verdana"><br>
</font><a href=http://www.vero.co.nz/><font size=1 color=red \
face="Verdana">www.vero.co.nz</font></a><font size=3><br> </font><img \
src=cid:_1_066EA1B8066E9F6C0070AF7ECC257478><font size=3><br> </font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Vijaya Manne&quot;
&lt;Vijaya.Surapaneni@theice.com&gt;</b> </font>
<p><font size=1 face="sans-serif">01/07/2008 05:28 a.m.</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
dev@xmlbeans.apache.org</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">&lt;dev@xmlbeans.apache.org&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Question of dateFormat in
XMLBeans</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 face="Arial">We are using XML Beans in our application.</font>
<br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial">Our schema uses </font>
<br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial"><b>Here is our schema for datetime:</b></font>
<br><font size=2 face="Arial">&nbsp; &lt;xs:simpleType \
name=&quot;UTCTimestamp&quot;&gt;<br>  &nbsp; &nbsp;&lt;xs:annotation&gt;<br>
 &nbsp; &nbsp; &nbsp;&lt;xs:documentation&gt;String representing Time/date
combination represented in UTC (Universal Time Coordinated, also known
as &#8220;GMT&#8221;) in either YYYYMMDD-HH:MM:SS (whole seconds) or \
YYYYMMDD-HH:MM:SS.sss (milliseconds) format, colons, dash, and period required. \
&nbsp; <br>  Valid values:<br>
 * 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).<br>
 * 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).<br>
Leap Seconds: &nbsp;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 &quot;19981231-23:59:59&quot;,
&quot;19981231-23:59:60&quot;, &quot;19990101-00:00:00&quot;. &nbsp;(see
</font><a href=http://tycho.usno.navy.mil/leapsec.html><font size=2 color=blue \
face="Arial"><u>http://tycho.usno.navy.mil/leapsec.html</u></font></a><font size=2 \
face="Arial">)<br> &lt;/xs:documentation&gt;<br>
 &nbsp; &nbsp;&lt;/xs:annotation&gt;<br>
 &nbsp; &nbsp;&lt;xs:restriction base=&quot;xs:dateTime&quot; /&gt;<br>
 &nbsp;&lt;/xs:simpleType&gt;</font>
<br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial">&nbsp; &lt;xs:simpleType \
name=&quot;TransactTime_t&quot;&gt;<br>  &nbsp; &nbsp;&lt;xs:annotation&gt;<br>
 &nbsp; &nbsp; &nbsp;&lt;xs:documentation xml:lang=&quot;en&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp;Time of execution/order creation (expressed in UTC
(Universal Time Coordinated, also known as &quot;GMT&quot;)<br>
 &nbsp; &nbsp;&lt;/xs:documentation&gt;<br>
 &nbsp; &nbsp; &nbsp;&lt;xs:appinfo&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;fm:Xref Protocol=&quot;FIX&quot; \
name=&quot;TransactTime&quot; tag=&quot;60&quot; datatype=&quot;UTCTimestamp&quot; \
ComponentType=&quot;Field&quot; StdAbbrev=&quot;TxnTm&quot; Category=&quot;&quot; \
CategoryAbbrev=&quot;&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp;&lt;/xs:appinfo&gt;<br>
 &nbsp; &nbsp;&lt;/xs:annotation&gt;<br>
 &nbsp; &nbsp;&lt;xs:restriction base=&quot;UTCTimestamp&quot; /&gt;<br>
 &nbsp;&lt;/xs:simpleType&gt;</font>
<br><font size=2 face="Arial">I believe that internally it uses XmlCalender
class to set the value for transaction time.</font>
<br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial"><b>Here is my implementation:</b></font>
<br><font size=2 face="Arial">&nbsp; &nbsp;public void setTransactionTime(Calendar
transactionTime)<br>
 &nbsp; {<br>
 &nbsp; &nbsp; &nbsp;if (transactionTime != null)<br>
 &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; transactionTime.clear(Calendar.MILLISECOND);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; _message.setTxnTm(transactionTime);<br>
 &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp;else if ( _message.isSetTxnTm() )<br>
 &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; _message.unsetTxnTm();<br>
 &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; }</font>
<br><font size=2 face="Arial">We need this field in the format of \
2008-06-30T13:26:20-0500</font> <br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial">But I am getting the value in the format
of 2008-06-30T13:26:20-05</font><font size=2 color=blue face="Arial">:</font><font \
size=2 face="Arial">00</font> <br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial">I would like to remove colon (:) from timezone
difference.</font>
<br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial">Does any body have any idea how to get datetime
field in custom format?</font>
<p><font size=2 color=#333333 face="Arial">Thanks</font>
<p><font size=2 color=#333333 face="Arial"><b>Vijaya Manne</b></font><font size=1 \
color=#333333 face="Arial"><br> IntercontinentalExchange | ICE<br>
2100 RiverEdge Pkwy | 5th Floor | Atlanta, GA 30328<br>
Tel: 770.857.0371</font><font size=1 color=blue face="Arial"><u><br>
</u></font><a href=mailto:vijaya.manne@theice.com><font size=1 color=blue \
face="Arial"><u>vijaya.manne@theice.com</u></font></a><font size=1 face="Arial"><br> \
</font> <p><font size=2 color=#333333 face="Arial">Production Issues \
Logging</font><font size=2 color=blue face="Arial"><u><br> </u></font><a \
href=https://www.theice.com/integrate><font size=2 color=blue \
face="Arial"><b><u>https://www.theice.com/integrate</u></b></font></a> <br><font \
size=1 color=#333333 face="Arial"><br> 24-hour ice helpdesk 770.738.2101</font><font \
size=3 color=blue><u><br> </u></font><a href=http://www.theice.com/ \
target=_blank><font size=1 color=blue \
face="Arial"><u>http://www.theice.com</u></font></a><font size=1 face="Arial"> \
</font> <br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br>
<hr noshade>
<p><font size=3>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. </font>
<p><font size=3><br>
The following message has been automatically added by the Internet mail
gateway to comply with the Group's Information Security requirements.<br>
<br>
&quot;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.<br>
<br>
In these cases you should not reply unless you are authorised to do so,
and adequate encryption is employed.&quot;<br>
<br>
If you have any questions, please contact the IS Service Desk.</font>
<p>
<BR>
**********************************************************************<BR>
CAUTION - This message is intended for the addressee named above. It may contain \
privileged or confidential information. <BR> <BR>
If you are not the intended recipient of this message you must: <BR>
- Not use, copy, distribute or disclose it to anyone other than the addressee;<BR>
- Notify the sender via return email; and<BR>
- Delete the message (and any related attachments) from your computer \
immediately.<BR> <BR>
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.<BR> <BR>
Unless otherwise stated, views expressed within this email are the author's own and \
do not represent those of Vero.<BR> <BR>
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.<BR>
**********************************************************************<BR>

--=_alternative 0070AF80CC257478_=--
--=_related 0070AF80CC257478_Content-Transfer-Encoding: base64
Content-Type: image/gif
Content-ID: <_1_066EA1B8066E9F6C0070AF7ECC257478>

R0lGODlhZAAtAOYAAO8AAP9mZpmZmWZmZv///0FBQfdjY97e3vU7O/7e3sXFxfEcHfzFxfmRkfh8
fHp6evAQEK2trfy1tfdPTu/v7/7r6vukpPIpKfhra2ZmZvZKSv+ZmYyMjL29vfiMjO8ICNbW1lFR
UfEZGf7W1qSkpPf39/qlpf+Zmebm5v7m5v/y8/IwMPdzc/daWv+MjPiEhLW1tfZDQ8zMzPy8vIOD
g5mZmfQbG//MzFtbW/QiIvusrPQQEHNzc0tLS/cICPmvr/cAAPQsLfdTU/7v7/UqKv/39/d7c/Eh
IfUyMf+lrQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5
BAQUAP8ALAAAAABkAC0AAAf/gASCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goZklBwcU
oqicICQgqa6YBw80CiWvtpIoDwUPHbW3v4woNCE4NCjAyIkUHAMDxsnQhcs4AwKn0cAlvgTT1dfY
tyAy1xQC1CSnJRQU2+ChMAIHguXUEbUlCiQd7qgkDzLzSODg0YtACRID/snj5ynXAAUBB9LihrAH
jQgMPXWgBuNehAE8ABI4wCzEAxgZOS3rMSBCuo8PWhEA8YBavJSbSBYYQOJYCRgJF4IYsAviiKNH
VSwqkuBoCkJMGUjY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yG9i/C7IRTQMIApphDAwZyI7MkvBC3M8JmEK9Cdd59KQuK97YW4wQSO
g7XxEQJsNmAcBnRUDl6ogwIHoEHnEsGAlh0BcRY4AgQwYKUiKO04GDBgIv4HM0EdBwIAhFAL3pOD
FxRtEHWp0ylQoAABIO8QezrhAiWEgHwNYgMJBMAEFuUIEhqCBSdkAaASR7UeIgJhNDjFzjrwM0SY
wD4ACIIBEmiAFxLgU9UhQgoTMYTuXW2MP7TXBBSTCIgdZwJLhCEMHnAMEERgIYuIEI6aIwKkrWwD
7wETEQ+hAx1MzIjkcx7jjJCIFPApdP1DRAfmMhIYVDF+PwjicSxziCjx0f8AM5gWAW7wgiCwgG6l
nBAaAQY6JPiQEEN4AYPGpggZkEAGJaDhN3iHhL0BAHGI2Jp9PhAED9wAKTewQNAuSJZcucyARZBA
DN5zAQtgZXsJIGWWDDDIQ9BQASigAAralogKOMA+EAjCxRIxAg8E4Us5QIAGYoAABJiOUsCD2wcW
MC8KsuA9C4jNC/6CAPsEwQHASwQpFHAAci5iBA5AgBAsEMdCqMACLJiAxgQHAQS8QALM0oxEdSBC
xjQAAyuwQRCQgAQbfAABLNCBzRZBARlcshE32IAEvKgIBjTAASyQ2gYSeqUZmEAH/yrXDBpgANix
YAP2g0QJMocTZOTSoVUEBUcgAAA7
--=_related 0070AF80CC257478_=--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic