<?xml version="1.0"?>
<exslt:function xmlns:exslt="http://exslt.org/documentation" 
               version="1" module="date" status="implemented">

<exslt:name>seconds</exslt:name>

<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 ID="date:seconds">
   <dc:subject>EXSLT</dc:subject>
   <dc:subject>date</dc:subject>
   <dc:subject>seconds</dc:subject>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:seconds.1">
         <exslt:version>1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-05-12</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Returns the result of converting the argument to a number of seconds, or current date/time in seconds since 1970-01-01T00:00:00Z.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:seconds.1.1">
         <exslt:version>1.1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-06-11</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Added Javascript implementation.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:seconds.1.2">
         <exslt:version>1.2</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com/">
            Jeni Tennison
         </dc:creator>
         <dc:date>2001-06-16</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            <ul>
               <li>Updated Javascript implementation.</li>
               <li>Added Microsoft-specific stylesheet.</li>
            </ul>
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:seconds.1.3">
         <exslt:version>1.3</exslt:version>
         <dc:creator email="craig.stewart@nottingham.ac.uk" 
                     url="">Craig Stewart</dc:creator>
         <dc:date>2002-08-21</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">Added libxslt implementation to the list.</dc:description>
      </rdf:Description>
   </exslt:revision>
</rdf:Description>

<exslt:doc xmlns:html="http://www.w3.org/1999/xhtml"
           xmlns="">
   <html:div xmlns="http://www.w3.org/1999/xhtml">
      <p>
         The <code>date:seconds</code> function returns the number of seconds specified by the argument string.  If no argument is given, then the current local date/time, as returned by <code>date:date-time</code> is used as a default argument.
      </p>
      <p>
         The argument string may be in one of the following formats:
      </p>
      <ol>
         <li>
            <p>
               A right-truncated date/time string in one of the formats defined in [<a href="http://www.w3.org/TR/xmlschema-2/" class="offsite">XML Schema Part 2: Datatypes</a>].  In these cases, the difference between the date/time string and 1970-01-01T00:00:00Z is calculated as with <code>date:difference</code> and the result is converted to seconds with <code>date:seconds</code>.
            </p>
            <p>
               The legal formats are as follows:
            </p>
            <ul>
               <li>
                  <a href="http://www.w3.org/TR/xmlschema-2/#dateTime" class="offsite"><code>xs:dateTime</code></a> (<code><var>CCYY</var>-<var>MM</var>-<var>DD</var>T<var>hh</var>:<var>mm</var>:<var>ss</var></code>)
               </li>
               <li>
                  <a href="http://www.w3.org/TR/xmlschema-2/#date" class="offsite"><code>xs:date</code></a> (<code><var>CCYY</var>-<var>MM</var>-<var>DD</var></code>)
               </li>
               <li>
                  <a href="http://www.w3.org/TR/xmlschema-2/#gYearMonth" class="offsite"><code>xs:gYearMonth</code></a> (<code><var>CCYY</var>-<var>MM</var></code>)
               </li>
               <li>
                  <a href="http://www.w3.org/TR/xmlschema-2/#gYear" class="offsite"><code>xs:gYear</code></a> (<code><var>CCYY</var></code>)
               </li>
            </ul>
         </li>
         <li>
            <p>
               A duration specified in days, hours, minutes and seconds in the format defined for <code>xs:duration</code> in [<a href="http://www.w3.org/TR/xmlschema-2/#duration" class="offsite">3.2.6 duration</a>] of [<a href="http://www.w3.org/TR/xmlschema-2/" class="offsite">XML Schema Part 2: Datatypes</a>].  The number of years and months in the duration string must both be equal to zero: either <code>P0Y0M120D</code> or <code>P120D</code> are permitted, but <code>P3M</code> is not.
            </p>
            <p>
               If the argument to <code>date:seconds</code> is defined as a duration, the number returned is the result of converting the duration to seconds by assuming that 1 day = 24 hours, 1 hour = 60 minutes and 1 minute = 60 seconds.
            </p>
            <p class="note">
               The permitted duration format is basically <code>P<var>n</var>DT<var>n</var>H<var>n</var>M<var>n</var>S</code>, although implementers should consult [<a href="http://www.w3.org/TR/xmlschema-2/" class="offsite">XML Schema Part 2: Datatypes</a>] and [<a href="http://www.iso.ch/markete/8601.pdf" class="offsite">ISO 8601</a>] for details.
            </p>
         </li>
      </ol>
      <p>
         If the argument is not in any of these formats, <code>date:seconds</code> returns <code>NaN</code>.
      </p>
   </html:div>
</exslt:doc>

<exslt:definition xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <exslt:return type="number" />
   <exslt:arg name="date-time" type="string" 
              optional="yes" default="date:date-time()" />
</exslt:definition>

<exslt:implementations>
   <exslt:vendor-implementation
           version="1"
           vendor="libxslt from Daniel Veillard et al."
           vendor-url="http://xmlsoft.org/XSLT/"
           vendor-version="1.0.19" />
   <exslt:implementation src="date.js" language="exslt:javascript" 
                         version="1">
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:seconds.js">
         <dc:subject>EXSLT</dc:subject>
         <dc:subject>date</dc:subject>
         <dc:subject>seconds</dc:subject>
         <dc:subject>Javascript</dc:subject>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="date:seconds.js.1">
               <exslt:version>1</exslt:version>
               <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource">
                  <vcf:fn>Chris Bayes</vcf:fn>
                  <vcf:email>chris@bayes.co.uk</vcf:email>
                  <vcf:url>http://www.bayes.co.uk</vcf:url>
               </dc:creator>
               <dc:date>2001-06-11</dc:date>
            </rdf:Description>
         </exslt:revision>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="date:seconds.js.2">
               <exslt:version>2</exslt:version>
               <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource">
                  <vcf:fn>Chris Bayes</vcf:fn>
                  <vcf:email>chris@bayes.co.uk</vcf:email>
                  <vcf:url>http://www.bayes.co.uk</vcf:url>
               </dc:creator>
               <dc:date>2001-06-16</dc:date>
            </rdf:Description>
         </exslt:revision>
      </rdf:Description>
   </exslt:implementation>
   <exslt:implementation src="date.msxsl.xsl" language="exslt:msxsl"
                         version="1">
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="date:seconds.msxsl">
         <dc:subject>EXSLT</dc:subject>
         <dc:subject>date</dc:subject>
         <dc:subject>seconds</dc:subject>
         <dc:subject>MSXML</dc:subject>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="date:seconds.msxsl.1">
               <exslt:version>1</exslt:version>
               <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource">
                  <vcf:fn>Chris Bayes</vcf:fn>
                  <vcf:email>chris@bayes.co.uk</vcf:email>
                  <vcf:url>http://www.bayes.co.uk</vcf:url>
               </dc:creator>
               <dc:date>2001-06-16</dc:date>
            </rdf:Description>
         </exslt:revision>
      </rdf:Description>
   </exslt:implementation>
</exslt:implementations>

<exslt:use-cases />

</exslt:function>
