Construct a date
value from an item value.
The following construct(s) refer to this construct:
xs:date(item $value) => date
This is a constructor function that takes an item value as argument and
returns a value of type xs:date
. If the argument is a literal,
then the literal must be a valid lexical form of its type.
As specified in the respective section of the W3C recommendation
XML
Schema Part 2: Datatypes, a value of type xs:date
represents a Gregorian calendar date as defined in ISO 8601. The lexical form
is CCYY-MM-DD where "CC" represents the century, "YY" the year, "MM" the month
and "DD" the day. You may not truncate digits on the left side. To represent a
date before Christ, you must prepend a minus sign.
$value |
item value |
---|
Generate a valid value of type xs:date
:
xs:date("2002-12-07")
Add an entry for the first Roman emperor:
<emperor> <name>Augustus</name> <birth> <date>{ xs:date("-0063-09-23") }</date> </birth> <death> <date>{ xs:date("0014-08-14") }</date> <place>Nola</place> </death> </emperor>