XML Schema Date/Time Data Type
Date and time data types are used to contain date and time values.
Date Data Type
The date data type is used to define dates.
Dates are defined using this format: "YYYY-MM-DD", where:
YYYY represents the year
MM represents the month
DD represents the number of days
Note:All ingredients are required
The following is an example of date declaration in schema:
The elements in the document should look something like this:
Time Zone
If required 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's adjusted time by adding a positive or negative time after the date - for example:
or
<start>2002-09-24+06: 00</start>
##h2>Time Data Type (Time Data Type)
The time data type is used to define time. Time is defined using the following format: "hh:mm:ss", where
- hh represents the hour
- mm means minutes
- ss means seconds
Note: All ingredients are required!
The following is an example of time declaration in schema:or
<start>09:30:10+06:00</start>
DateTime Data Type
DateTime Data Type is used to define date and time.
The date and time are defined using the following format: "YYYY-MM-DDThh:mm:ss", where:
YYYY represents the year
MM represents the month
DD represents the day
T represents the beginning of the required time part
hh represents hours
mm represents minutes
ss represents seconds
Note: All ingredients are required!
The following is an example of date and time declaration in schema:
The elements in the document should look something like this:
Or something like this:
Time zone
if needed To specify a time zone, you can also enter a date and time using Universal Adjusted Time (UTC time) by adding a "Z" after the date and time - for example:
Alternatively, you can specify an offset based on the world adjustment time by adding a positive or negative time after the time. Amount - For example:
or
< startdate>2002-05-30T09:30:10+06:00</startdate>
h2>Duration Data Type (Duration Data Type)
Duration data type is used at specified time intervals.
The time interval is specified using the following format: "PnYnMnDTnHnMnS", where:
- ##P represents the period (required)
- nY represents the number of years
- nM represents the number of months
- nD represents the number of days
- T represents the time Start of part (required if you plan to specify hours, minutes, and seconds)
- nH represents the number of hours
- nM Represents the number of minutes
- nS Represents the number of seconds
The above example represents a 5-year, 2-month and 10-day period.
Or something like this:
The above example represents a period of 5 years, 2 months, 10 day and 15-hour periods.
Or similar to this:
The above example represents a 15-hour period.
Negative duration
To specify a negative duration, enter a minus sign before P:
The above example represents a negative 10-day period.
Date and time data types
Name | Description |
---|---|
date | Define a date value |
dateTime | Define a date and time value |
duration | Define a time interval |
gDay | Define a part of a date - day (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 the date A Part - Year and Month (YYYY-MM) |
time | Define a time value |
Restriction on date data type (Restriction)
Restrictions that can be used with date data type:
enumeration
maxExclusive
maxInclusive
minExclusive
minInclusive
pattern
whiteSpace