<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
<document>
    <header>
        <title>DateTime Sample</title>
    </header>
    <body>
        <section>
            <title>Description</title>
            <p>Author: Rashmi Banthia</p>
            <p>Available: 2004-10-28</p>
            <p>Versions: xmlbeans-1.0.3, xmlbeans-v2</p>
<p>
This sample demonstrates how you can work with XML Schema primitive types
date, dateTime, time, duration, gDay.
<br/>
This sample illustrates how you can
</p>
<ol>
  <li>Convert org.apache.xmlbeans.XmlDate to java.util.Calendar,org.apache.xmlbeans.GDate, java.util.Date</li>
  <li>Convert org.apache.xmlbeans.XmlTime to java.util.Calendar,org.apache.xmlbeans.GDate, java.util.Date</li>
  <li>Convert org.apache.xmlbeans.XmlDuration to org.apache.xmlbeans.GDuration</li>
  <li>Convert org.apache.xmlbeans.XmlGday to java.util.Calendar,org.apache.xmlbeans.GDate, Day - primitive java int</li>
  <li>Get/Set XML Schema primitive types date, dateTime, time, duration, and gDay.</li>
</ol>
<p>
XMLBean Types provide mapping between natural Java classes and W3C Schema
types.  For eg:
</p>
<table>
  <tr>
    <td>Schema Type</td>
    <td>Formal Class</td>
    <td>Natural Java Class</td>
  </tr>
  <tr>
    <td>xs:date</td>
    <td>XmlDate</td>
    <td>java.util.Calendar (XmlCalendar)</td>
  </tr>
  <tr>
    <td>xs:time</td>
    <td>XmlTime</td>
    <td>java.util.Calendar (XmlCalendar)</td>
  </tr>
  <tr>
    <td>xs:dateTime</td>
    <td>XmlDateTime</td>
    <td>java.util.Calendar (XmlCalendar)</td>
  </tr>
  <tr>
    <td>xs:duration</td>
    <td>XmlDuration</td>
    <td>org.apache.xmlbeans.GDuration</td>
  </tr>
</table>
<p>
The XmlCalendar is a subclass of GregorianCalendar that modifies several key
details in the behavior of GregorianCalendar to make it more useful when
dealing with XML dates.
</p>
        </section>
        <section>
            <title>Files</title>
            <ul>
              <li><a href="DateTime.zip">Zip of all files (DateTime.zip)</a></li>
              <li><a href="DateTime.tgz">Tar gzip of all files (DateTime.tgz)</a></li>
            </ul>
            <ul>
              <li><a href="http://svn.apache.org/viewcvs.cgi/*checkout*/xmlbeans/trunk/samples/DateTime/README.txt">Readme file</a></li>
              <li><a href="http://svn.apache.org/viewcvs.cgi/*checkout*/xmlbeans/trunk/samples/DateTime/src/org/apache/xmlbeans/samples/datetime/DateTime.java">DateTime.java</a></li>
              <li><a href="http://svn.apache.org/viewcvs.cgi/*checkout*/xmlbeans/trunk/samples/DateTime/schemas/datetime.xsd">datetime.xsd</a></li>
              <li><a href="http://svn.apache.org/viewcvs.cgi/*checkout*/xmlbeans/trunk/samples/DateTime/xml/datetimesample.xml">datetimesample.xml</a></li>
              <li><a href="http://svn.apache.org/viewcvs.cgi/*checkout*/xmlbeans/trunk/samples/DateTime/build.xml">build.xml</a></li>
            </ul>
        </section>
    </body>
</document>

