Date and Time Types


Figure A-3 shows the date and time types in the XSD type hierarchy. As you can see in the figure, all the date and time types are primitive types. Please note that all dates are expressed as dates in the Gregorian calendar.

click to expand
Figure A-3: The date and time type group contains only primitive types.

date

The date type represents a calendar date. It takes the form YYYY-MM-DD, where YYYY, MM, and DD represent the year, month, and day, respectively, of the date in question. You can add a time zone to the right of the date, expressed as a Z to indicate Coordinated Universal Time (UTC) or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

DATETIME

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<date>2010-05-25+01:00</date> <date>2001-07-14</date> 

dateTime

The dateTime type represents an instant in time given as a concatenation of a date and a time. It takes the form YYYY-MM-DDThh:mm:ss, where T is the separator between date and time, and YYYY, MM, DD, hh, mm, and ss represent the year, month, day, hour, minute, and second, respectively, of the instant in time. You can express the number of seconds by using a decimal fraction, and you can add a time zone to the right of the time, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

DATETIME

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<datim>2003-03-10T16:10:06+01:00</datim> <datim>1993-06-02T00:00:00</datim> 

duration

The duration type represents a period of time written in accordance with ISO 8601. It takes the form PnYnMnDTnHnMnS, where T is the separator between date and time, and nY, nM, nD, nH, nM, and nS specify the number of years, months, days, hours, minutes, and seconds, respectively, in the period of time. If n = 0 for any of these units, the unit can be omitted as long as P and one unit of time are still present. If you’re not using hours, minutes, or seconds, you can also omit the separator T.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.TimeSpan

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<dur>P1Y4M15DT9H7M15S/dur> <dur>P10DT8M</dur> <dur>P3M</dur> 

gDay

The gDay type represents a specific day of the month. It takes the form ---DD. You can add a time zone to the right of the date, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<gD>---17</gD> <gD>---01Z</gD> 

gMonth

The gMonth type represents a specific month of the year. The type’s value takes the form --MM--. You can add a time zone to the right of the date, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<gM>--02--</gM> <gM>--01--+10:00</gM> 

gMonthDay

The gMonthDay type represents a specific day in a specific month (that recurs annually). It takes the form --MM-DD, where MM and DD represent the month and day, respectively. You can add a time zone to the right of the date, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<gMD>--02-28</gMD> <gMD>--08-12-07:00</gMD> 

gYearMonth

The gYearMonth type represents a specific month in a specific year. It takes the form YYYY-MM, where YYYY and MM represent the year and month in question, respectively. You can add a time zone to the right of the date, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<gYM>1976-06</gYM> <gYM>3001-09-13:00</gYM> 

gYear

The gYear type represents a specific year. It takes the form YYYY, where YYYY represents the year in question. You can add a time zone to the right of the date, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<gYr>1876</gYr> <gYr>2061-07:00</gYM> 

time

The time type represents a time of the day. It takes the form hh:mm:ss, where hh, mm, and ss represent the hour, minute and second, respectively, of the instant in time. You can express the number of milliseconds by adding a decimal fraction to the right of the time value, and you can add a time zone to the right of the time, expressed as a Z to indicate UTC or as the difference between local time and UTC.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

N/A

N/A

System.DateTime

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<time>12:00:00.00+03:00</time> <time>18:59:31.436-07:00</time> <time>09:30:42Z</time> 




Programming Microsoft. NET XML Web Services
Programming MicrosoftВ® .NET XML Web Services (Pro-Developer)
ISBN: 0735619123
EAN: 2147483647
Year: 2005
Pages: 172

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net