DateTime
Last updated
Last updated
Internet Object DateTime is inspired by the ISO 8601 format. DateTime can be passed as a string and is represented in the following ways, with or without separators.
Date Time format with separator: YYYY-MM-DDThh:mm:ss.SSSZ
Example : 1997-07-16T19:20:30.500+01:00
Date Time format without separator: YYYYMMDDThhmmss.SSSZ
Example: 19970716T192030.500+0100
The DateTime is the string type and therefore there is no need to enclose it in the double quotation mark (" U+0022)
as parser identifies it as a string.
Here, T
is a delimiter used to separate the date
from the time
. The time
portion in the DateTime
object must be preceded by T
. Z
represents the time zone designator (+hh:mm
or -hh:mm
).
Symbol | Represents | Range | Default Value |
| Year |
|
|
| Date |
|
|
| Month |
|
|
| Hour |
|
|
| Minute |
|
|
| Second |
|
|
| Millisecond |
|
|
The Year field must be provided as it does not have any default value.
Symbol | Character | Unicode | Description |
| Hyphen |
| Used to separate parts of the date |
| Colon |
| Used to different parts of time |
| Period |
| Used to separate seconds from milliseconds |
| Alphabet |
| DateTime separator |
The Date must be complete such as YYYY-MM-DD or YYYYMMDD before providing the time.
The Time Zone can be represented as ±hh: mm
or ±hhmm
i.e with or without separators. For example, +00:00
, +0000
or +00
. However, representing -00:00
, -0000
, or -00
is not permitted. While representing a Time Zone, a plus sign must be used for positive zero values and a minus sign for negative values.
Time Zone is written at the end of a DateTime. It is not a separate data type on its own. It can only be passed when both date and time are passed to a DateTime object. "Z"
can be directly added after time without space, where "Z"
is the zone designator for the zero UTC offset. It defaults to Z or Zulu Time or Greenwich mean time (GMT) or +0:00
.
Time Zone with separators: | Time Zone without Separators: |
|
|
|
|
|
|
|
|
Valid date-time representation with separator separating date, time, and time-zone
Valid date-time representation without separator separating date, time, and time-zone.
Defining date time in the Internet Object Document.
Defining date time with timezone in the Internet object Document.
The date and time must be complete such as YYYY-MM-DDTHH:mm:ss.SSS or YYYYMMDDTHHmmssSSS before providing timezone.
The DateTime is derived from the String type, hence it shares the same MemberDef as the String. However, DateTime enforces additional constraints with the respective Datetime format and the same is applicable to the DateTime MemberDef.