view m-toolbox/html_help/help/ug/constructor_examples_timespan_content.html @ 13:e05504b18072 database-connection-manager

Move more functions to utils.repository
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_timespan_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_timespan.html#empty">Construct empty TIMESPAN object</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_timespan.html#xml_file">Construct a TIMESPAN object by loading the object from a file</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_timespan.html#start_end">Construct a TIMESPAN object with a start and end time</a>
    </td>
  </tr>
  <tr>
    <td>
      <a href="constructor_examples_timespan.html#plist">Construct a TIMESPAN object from a parameter list (PLIST) object</a>
    </td>
  </tr>
</table>
<!-- --------------- Link box: end --------------- -->

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

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

name      : None
start     : 2008-03-30 20:00:00.000
end       : 2008-03-30 20:00:00.000
timeformat: yyyy-mm-dd HH:MM:SS.FFF
interval  :
timezone  : UTC

created   : 2008-03-30 20:00:00.000
version   : $Id: timespan.m,v 1.23 2008/03/25 10:57:49 mauro Exp
plist     : plist class
---------------------------------
</pre></div>

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

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

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

<hr>
<h2 class="title"><a name="start_end"></a>Construct a TIMESPAN object with a start and end time</h2>
<p>It is possible to specify the start-/end- time either with a time-object or with a time string.</p>
<div class="fragment"><pre class="programlisting">
t1_obj = time(<span class="string">'14:00:00'</span>);
t2_obj = time(<span class="string">'15:00:00'</span>);
t1_str = <span class="string">'14:00:00'</span>;
t2_str = <span class="string">'15:00:00'</span>;

ts1 = timespan(t1_obj, t2_obj)    <span class="comment">% two time-objects</span>
ts2 = timespan(t1_obj, t2_obj)    <span class="comment">% two strings</span>
ts3 = timespan(t1_str, t2_obj)    <span class="comment">% combination of time-object and string</span>
ts4 = timespan(t1_str, t2_str)    <span class="comment">% combination of time-object and string</span>
</pre></div>


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

<hr>
<h2 class="title"><a name="plist"></a>Construct a TIMESPAN object from a parameter list (PLIST) object</h2>
<p>Construct an TIMESPAN by its properties definition
  <table border="0" summary="Simple list" class="simplelist_nottable_last" width="50%">
    <tr valign="top">
      <td width="25%">
        <p>'start'</p>
      </td>
      <td width="75%">
        <p>The starting time<br />[default: '1970-01-01 00:30:00.000']</p>
      </td>
    </tr>
    <tr valign="top">
      <td width="25%">
        <p>'end'</p>
      </td>
      <td width="75%">
        <p>The ending time<br />[default: '1980-01-01 12:00:00.010']</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) [default: 'yyyy-mm-dd HH:MM:SS.FFF']</p>
      </td>
    </tr>
  </table>
</p>
<div class="fragment"><pre class="programlisting">
t1 = time(<span class="string">'14:00:00'</span>);
t2 = time(<span class="string">'15:00:00'</span>);

pl1 = plist(<span class="string">'start'</span>, t1, ...
            <span class="string">'end'</span>,   t2);
pl2 = plist(<span class="string">'start'</span>,       t1, ...
            <span class="string">'end'</span>,         t2, ...
            <span class="string">'timeformat'</span>, <span class="string">'yyyy-mm-dd HH:MM:SS'</span>, ...
            <span class="string">'timezone'</span>,   <span class="string">'CET'</span>);

ts1 = timespan(pl1)
ts2 = timespan(pl2)
</pre></div>



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