148
XQuery current-time() Function
The XQuery current-time function is used to retrieve the current time.
XQuery current-time() Example
Use the following XQuery expression to fetch the current time.
current-time.xqy:
Create a Java based XQuery executor program to read the current-time.xqy, passes it to the XQuery expression processor, and executes the expression. After that the result will be displayed.
XQueryTester.java
Execute XQuery against XML
Put the above both files to a same location. We put them on desktop in a folder name XQuery11. Compile XQueryTester.java using console. You must have JDK 1.5 or later installed on your computer and classpaths are configured.
Compile:
javac XQueryTester.java
Execute:
java XQueryTester
Output:
Next TopicXQuery current-dateTime() Function