May 28, 2021 XML Schema
The XSD date and time data type defines the date and time in the document.
The date and time data type is used to contain the value of the date and time.
The date data type is used to define the date.
Dates are defined in this format: "YYYY-MM-DD", where:
Note: All ingredients are required
Here's an example of a date declaration in schema:
The elements in the document should look something like this:
To specify a time zone, you can also enter a date using UTC time by adding a "Z" after the date - for example:
Alternatively, you can specify an offset based on the world adjustment time by adding a positive or negative time after the date - for example:
Tip: When using xs:date() to cast a string as a date type, the format of string parameters needs to be strictly followed: yyyy-mm-dd.
h2; Time Data Type
The time data type is used to define the time.
Time is defined in the following format: "hh:mm:ss", where
Note: All ingredients are required!
Here's an example of a time statement in schema:
The elements in the document should look something like this:
Or something like this:
To specify a time zone, you can also enter a time using UTC time by adding a "Z" after the time - for example:
Alternatively, you can specify an offset based on the world adjustment time by adding a positive or negative time after time - for example:
The date-time data type is used to define the date and time.
Date time is defined in the following format: "YYYY-MM-DDThh:mm:ss", where:
Note: All ingredients are required!
Here's an example of a date-time declaration in schema:
The elements in the document should look something like this:
Or something like this:
To specify a time zone, you can also enter a date time using UTC time by adding a "Z" after the date time - for example:
Alternatively, you can specify an offset based on the world adjustment time by adding a positive or negative time after time - for example:
h2; Duration Data Type
The duration data type is used to specify the interval.
The interval is specified in the following format: "PnYnMnDTnHnMnS", where:
Here's an example of a duration declaration in schema:
The elements in the document should look something like this:
The example above represents a 5-year cycle.
Or something like this:
The example above represents a 5-year, 2-month, and 10-day cycle.
Or something like this:
The example above represents a 5-year, 2-month, 10-day, and 15-hour cycle.
Or something like this:
The example above represents a 15-hour cycle.
To specify a negative duration, enter a minus sign before P:
The example above represents a period of minus 10 days.
Name | Describe |
---|---|
date | Define a date value |
Datetime | Define a date and time value |
duration | Define an interval |
gDay | Define a part of the date - days (DD) |
gMonth | Define a part of the date - month (MM) |
gMonthDay | Define a part of the date - month and day (MM-DD) |
gYear | Define a part of the date - Year (YYYY) |
gYearMonth | Define a part of the date - year and month (YYYY-MM) |
time | Define a time value |
Qualifications that can be used with date data types:
The above is about the XML Schema Date/Time data type.