The current-date() function

Smartsite 7.9 - ...

The current-date() XPath 2.0 function returns the current date.

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

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="">
     <currentdate />
     <currenttime />
    </data>
   </xf:instance>
   <xf:bind nodeset="currentdate" type="xf:date" />
   <xf:action ev:event="xforms-model-construct-done">
    <xf:setvalue ref="currentdate" value="fn:current-date()" />
   </xf:action>
  </xf:model>
 </head>
 <body>
  <xf:group xml:lang="nl-nl">
   <xf:output value="exf:format-datetime(currentdate,'d')" />
   <xf:output value="exf:format-datetime(fn:current-date(),'D')" />
  </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.