# xf:current-dateTime

Gets the current date and time.

### Signatures

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

### Returns

Returns the current date and time as a dateTime value.

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

### Examples

#### Invoke Once

The following simple example query, calls the current-dateTime function a single time:

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

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

    <current>2002-11-11T04:23:14.9030000</current>

#### Invoke Multiple Times

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

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

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

    <current>
    	<first>2002-11-11T04:23:34.5430000</first>
    	<second>2002-11-11T04:23:34.5430000</second>
    </current>

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

Related Topics

W3C current-dateTime function description.

W3C dateTime data type description.