xs:dateTime

Construct a dateTime value from an item value.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

xs:dateTime(item $value) => dateTime

Description

This is a constructor function that takes an item value as argument and returns a value of type xs:dateTime. 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:dateTime represents a specific instant of time by a combination of date and time of day values. The lexical form is CCYY-MM-DDThh:mm:ss where "CC" represents the century, "YY" the year, "MM" the month and "DD" the day. It can be preceded by an optional leading minus sign to indicate a negative number . You may not truncate digits on the left side. The letter "T" separates date from time and "hh", "mm", "ss" represent hour, minute and second. Fractions of a second are appended with a leading ".".

A datetime value may include a time zone which is either a capital "Z" to denote Coordinated Universal Time (UTC), or it is a value whose lexical form is hh:mm, preceded by a minus or plus sign to indicate the difference from UTC.

Argument

$value

item value

Example

  • Generate a valid value of type xs:dateTime:

    xs:dateTime("2002-12-07T12:20:46.275+01:00")

    This represents December 7, 2002 at 12:20:46 and 275/1000 seconds CET. The timezone CET is 1 hour after UTC.