The current-dateTime() function

Smartsite 7.9 - ...

The current-dateTime() XPath 2.0 function returns the current date and time (with timezone).

XML CopyCode image Copy Code
xs:dateTimeStamp fn:current-dateTime()

Parameters:

  • none 

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:fn="http://www.w3.org/2005/xpath-functions" 
 xmlns:exf="http://smartsite.nl/namespaces/xforms/1.0" 
 xmlns:ev="http://www.w3.org/2001/xml-events" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <head>
  <title>Example</title>
  <xf:model>
   <xf:instance>
    <data xmlns="">
     <currentdatetime></currentdatetime>
     <currentdatetime2></currentdatetime2>
    </data>
   </xf:instance>
   <xf:bind nodeset="currentdatetime" type="xf:dateTime" />
   <xf:action ev:event="xforms-model-construct-done">
    <xf:setvalue ref="currentdatetime" value="fn:current-dateTime()" />
   </xf:action>
  </xf:model>
 </head>
 <body>
  <xf:group xml:lang="nl-nl">
   <xf:output ref="currentdatetime" />
   <xf:output value="exf:format-datetime(currentdatetime,'G')" />
   <xf:output value="exf:format-datetime(fn:current-dateTime(),'G')" />
  </xf:group>
  <xf:group xml:lang="en-us">
   <xf:output ref="currentdatetime" />
   <xf:output value="exf:format-datetime(currentdatetime,'G')" />
   <xf:output value="exf:format-datetime(fn:current-dateTime(),'G')" />
  </xf:group>
 </body>
</html>


Namespace

This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).

Availability

This function is available as of Smartsite 7.9 / SFS release 30.