Returns the date and time when a file was modified.
last-modified($uri as xs:string?) ➔ xs:dateTime
The URI of the required file
Notes on the Saxon implementation
Available since Saxon 9.0; revised in Saxon 9.2. Not available in SaxonCS.
If the argument is an empty sequence, the result is an empty sequence.
Otherwise the argument must be a valid URI. If it is a relative URI, this will be
resolved against the base URI from the static context. The function has been tested with
URIs using the
http schemes, and is not guaranteed to
give a result with other URI schemes (or indeed with these, under all
The function returns an
xs:dateTime value which will usually be in a
specific timezone. The result can therefore be formatted using the
format-dateTime() function, or input to arithmetic and comparisons
against other dates and times.
If the URI is not syntactically valid, error FODC0005 is thrown. If the resource identified by the URI cannot be retrieved, error FODC0002 is thrown. If the resource is successfully retrieved but no date/time information is available, the function returns an empty sequence.
This function differs from the EXPath function
file:last-modified in that it takes
a URI rather than a filename as input, and may work for resources other than files: for example,
HTTP resources, provided the
last-modified header is present in the HTTP response.
To find the last-modified date of the file from which a given node was loaded, use