xf:current-time

Gets the current time.

Signatures

xf:current-time() —> xs:time?

Returns

Returns the current date and time as a time value.

All invocation of this function in a single outermost XQuery or XPATH expression will report the same time.

Examples

Invoke Once

The following example query, invokes the current-time function a single time:

<current>{xf:current-time()}</current> 

If the current date is November 11, 2002 and the current time is 4:23, The preceding query generates the following result:

<current>04:23:14.9030000</current> 

Invoke Multiple Times

The following example query, invokes the current-time function twice:

<current>
<first>{xf:current-time()}</first>
<second>{xf:current-time()}</second>
</current> 

If the current date is November 11, 2002 and the current time is 4:23, The preceding query generates the following result:

<current>
<first>04:23:34.5430000</first>
<second>04:23:34.5430000</second>
</current> 

Note: The same exact time (even seconds) is returned for both invocations of the function.

Related Topics

W3C current-time function description.

W3C time data type description.