XML current-date()
- The
current-date()
function in XQuery is used to return the current date. - It returns a date value that represents the current date according to the system clock.
Syntax
current-date()
Example
let $today := current-date()
return $today
Output
The output of the above example will be a date value representing the current date, for example:
2021-07-14
Explanation
The current-date()
function returns a date value that represents the current date based on the system clock. The date value is always in the format YYYY-MM-DD
.
Use
The current-date()
function is useful for applications that need to perform operations based on the current date. For example, it can be used to stamp a document with the current date or to perform calculations based on the current date.
Important Points
- The
current-date()
function returns a date value in the formatYYYY-MM-DD
. - The value returned by
current-date()
is based on the system clock of the machine running the XQuery processor. - The
current-date()
function does not require any parameters.
Summary
The current-date()
function in XQuery returns the current date as a date value in the format YYYY-MM-DD
. It is useful for applications that need to perform date-based operations. The function does not require any parameters.