view m-toolbox/html_help/help/ug/constructor_examples_time_content.html @ 12:86aabb42dd84 database-connection-manager

Use utils.repository utilities
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

<!-- $Id: constructor_examples_time_content.html,v 1.1 2008/03/30 20:40:04 ingo Exp $ -->

<!-- -------------------------------------------------- -->
<!-- --------------- BEGIN CONTENT FILE --------------- -->
<!-- -------------------------------------------------- -->

<!-- --------------- Link box: begin --------------- -->
<table border="0" summary="Simple list" class="simplelist_nottable_last">
  <tr>
    <td>
      <a href="constructor_examples_time.html#empty">Construct empty TIME object</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_time.html#xml_file">Construct a TIME object by loading the object from a file</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_time.html#string">Construct a TIME object from a string</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_time.html#string_format">Construct a TIME object from a string and time format</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_time.html#epoch">Construct a TIME object from the unix epoch time</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_time.html#plist">Construct a TIME object from a parameter list (PLIST) object</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_time.html#"></a>
    </td>
  </tr>
</table>
<!-- --------------- Link box: end --------------- -->

<!-- --------------- NEXT EXAMPLE --------------- -->

<hr>
<h2 class="title"><a name="empty"></a>Construct empty TIME object</h2>
<p>The following example creates an empty time object</p>
<div class="fragment"><pre class="programlisting">
t = time()
---------- time 01 ----------

name           : None
utc_epoch_milli: 1206904199919
timezone       : UTC
timeformat     : yyyy-mm-dd HH:MM:SS.FFF
time_str       : 2008-03-30 19:09:59.919

created        : 2008-03-30 19:09:59.919
version        : $Id: time.m,v 1.33 2008/03/27 13:59:06 mauro Exp
plist          :
-----------------------------
</pre></div>

<!-- --------------- NEXT EXAMPLE --------------- -->

<hr>
<h2 class="title"><a name="xml_file"></a>Construct a TIME object by loading the object from a file</h2>
<p>The following example creates a new time object by loading the time object from disk.</p>
<div class="fragment"><pre class="programlisting">
t = time(<span class="string">'time.mat'</span>)
t = time(<span class="string">'time.xml'</span>)
</pre></div>

<!-- --------------- NEXT EXAMPLE --------------- -->

<hr>
<h2 class="title"><a name="string"></a>Construct a TIME object from a string</h2>
<p>Create a time object with different string formats.</p>
<div class="fragment"><pre class="programlisting">
t1 = time(<span class="string">'14:00:00'</span>)              <span class="comment">% HH:MM:SS</span>
t1 = time(<span class="string">'14:00:00.123'</span>)          <span class="comment">% HH:MM:SS.FFF</span>
t2 = time(<span class="string">'2008.04.01 17:00:00'</span>)   <span class="comment">% yyyy.mm.dd. HH:MM:SS</span>
t3 = time(<span class="string">'17:00:00 2008.04.01'</span>)   <span class="comment">% HH:MM:SS yyyy.mm.dd</span>
t4 = time(<span class="string">'17:00:00 2008-04-01'</span>)   <span class="comment">% HH:MM:SS yyyy-mm-dd</span>
</pre></div>
<p>You can combine the following string formats:
  <ul>
    <li>HH:MM:SS</li>
    <li>MM:SS</li>
    <li>dd-mm-yyyy</li>
    <li>dd.mm.yyyy</li>
    <li>yyyy-mm-dd</li>
    <li>yyyy.mm.dd</li>
    <li>mm-dd</li>
    <li>.fff</li>
  </ul>
</p>

<!-- --------------- NEXT EXAMPLE --------------- -->

<hr>
<h2 class="title"><a name="string_format"></a>Construct a TIME object from a string and time format</h2>
<p>Create a time object with different string formats and a time format. The time format is either a MATLAB format string or a MATLAB format number.</p>
<div class="fragment"><pre class="programlisting">
t1 = time(<span class="string">'14:00:00'</span>, <span class="string">'HH:MM:SS'</span>)
t2 = time(<span class="string">'14:00:00'</span>, <span class="string">'yyyy.mm.dd HH:MM:SS'</span>)
t3 = time(<span class="string">'14:00:00'</span>, 31)
t4 = time(<span class="string">'14:00:00'</span>, 17)
</pre></div>

<!-- --------------- NEXT EXAMPLE --------------- -->

<hr>
<h2 class="title"><a name="epoch"></a>Construct a TIME object from the unix epoch time</h2>
<p>Create a time objrct from the unix epoch time. The epoch time starts from '1970-01-01 00:00:00.000'<br />Remark: the epoch time must be in milliseconds</p>
<div class="fragment"><pre class="programlisting">
t1 = time(0)
t2 = time(1206900000000) <span class="comment">% 2008-03-30 18:00:00</span>
</pre></div>


<!-- --------------- NEXT EXAMPLE --------------- -->

<hr>
<h2 class="title"><a name="plist"></a>Construct a TIME object from a parameter list (PLIST) object</h2>
<p></p>

<!-- --------------- key-word 'utc_epoch_milli' --------------- -->

<h3 class="title"><a name="utc_epoch_milli"></a>Use the key word 'utc_epoch_milli'</h3>
<p>Construct a TIME by its properties definition
  <table border="0" summary="Simple list" class="simplelist_nottable_last" width="50%">
    <tr valign="top">
      <td width="25%">
        <p>'utc_epoch_milli'</p>
      </td>
      <td width="75%">
        <p>The time in milliseconds [default: 0]</p>
      </td>
    </tr>
  </table>
</p>
<p>Additional parameters:
  <table border="0" summary="Simple list" class="simplelist_nottable_last" width="50%">
    <tr valign="top">
      <td width="25%">
        <p>'timezone'</p>
      </td>
      <td width="75%">
        <p>Timezone (string or java object) [default: 'UTC']</p>
      </td>
    </tr>
    <tr valign="top">
      <td width="25%">
        <p>'timeformat'</p>
      </td>
      <td width="75%">
        <p>Time format (string)<br />[default: 'yyyy-mm-dd HH:MM:SS.FFF']</p>
      </td>
    </tr>
  </table>
</p>

<div class="fragment"><pre class="programlisting">
pl1 = plist(<span class="string">'utc_epoch_milli'</span>, 1206900000000);
pl2 = plist(<span class="string">'utc_epoch_milli'<span class="string">, 1206900000000, ...
            <span class="string">'timeformat'<span class="string">,      <span class="string">'HH:MM:SS'<span class="string">,    ...
            <span class="string">'timezone'<span class="string">,        <span class="string">'CET'<span class="string">);

t1 = time(pl1)
t2 = time(pl2)
</pre></div>

<!-- --------------- key-word 'time_str' --------------- -->

<h3 class="title"><a name="time_str"></a>Use the key word 'time_str'</h3>
<p>Construct a TIME by its properties definition
  <table border="0" summary="Simple list" class="simplelist_nottable_last" width="50%">
    <tr valign="top">
      <td width="25%">
        <p>'time_str'</p>
      </td>
      <td width="75%">
        <p>the time string [default: '1970-01-01 00:00:00.000']</p>
      </td>
    </tr>
  </table>
</p>
<p>Additional parameters:
  <table border="0" summary="Simple list" class="simplelist_nottable_last" width="50%">
    <tr valign="top">
      <td width="25%">
        <p>'timezone'</p>
      </td>
      <td width="75%">
        <p>Timezone (string or java object) [default: 'UTC']</p>
      </td>
    </tr>
    <tr valign="top">
      <td width="25%">
        <p>'timeformat'</p>
      </td>
      <td width="75%">
        <p>Time format (string)<br />[default: 'yyyy-mm-dd HH:MM:SS.FFF']</p>
      </td>
    </tr>
  </table>
</p>

<div class="fragment"><pre class="programlisting">
pl1 = plist(<span class="string">'time_str'</span>, <span class="string">'14:00:00 15.01.2008'</span>);
pl2 = plist(<span class="string">'time_str'</span>, <span class="string">'14:00:00 15.01.2008'</span>, ...
            <span class="string">'timeformat'</span>,      <span class="string">'HH:MM:SS'</span>,        ...
            <span class="string">'timezone'</span>,        <span class="string">'CET'</span>);

t1 = time(pl1)
t2 = time(pl2)
</pre></div>

<!-- ------------------------------------------------ -->
<!-- --------------- END CONTENT FILE --------------- -->
<!-- ------------------------------------------------ -->