DateTime

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).

Legends

The Year field must be provided as it does not have any default value.

Separator Legends

The Date must be complete such as YYYY-MM-DD or YYYYMMDD before providing the time.

Time Zone

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.

Valid date-time representation with separator separating date, time, and time-zone

# DateTime with separators 
YYYY-MM-DDTHH:mm:ss.SSSZ = 2020-12-31T12:34:55.675Z # 2020-12-31T12:34:55.675Z
YYYY-MM-DDTHH:mm:ss.SSS	= 2020-12-31T12:34:55.675 # 2020-12-31T12:34:55.675
YYYY-MM-DDTHH:mm:ss = 2020-12-31T12:34:55 # 2020-12-31T12:34:55.000
YYYY-MM-DDTHH:mm = 2020-12-31T12:34 # 2020-12-31T12:34:00.000
YYYY-MM-DDTHH = 2020-12-31T12 # 2020-12-31T12:00:00.000
YYYY-MM-DD = 2020-12-31 # 2020-12-31T00:00:00.000
YYYY-MM = 2020-12 # 2020-12-01T00:00:00.000
YYYY = 2020 # parsed as 2020-01-01T00:00:00.000

Valid date-time representation without separator separating date, time, and time-zone.

# DateTime without separators 
YYYYMMDDTHHmmssSSSZ	= 20201231T123455.675Z # 2020-12-31T12:34:55.675Z
YYYYMMDDTHHmmssSSS = 20201231T123455.675 # 2020-12-31T12:34:55.675
YYYYMMDDTHHmmss = 20201231T123455 # 2020-12-31T12:34:55.000
YYYYMMDDTHHmm = 20201231T1234 # 2020-12-31T12:34:00.000
YYYYMMDDTHH	= 20201231T12 # 2020-12-31T12:00:00.000
YYYYMMDD = 20201231 # 2020-12-31T00:00:00.000
YYYYMM = 202012 # 2020-12-01T00:00:00.000
YYYY = 2020 # parsed as 2020-01-01T00:00:00.000

Defining date time in the Internet Object Document.

# Set loginDatetime type as datetime  
loginDatetime: datetime
---
~  2020-01-31T10:34:55.675
~  20200131T103855.324

Defining date time with timezone in the Internet object Document.

# Set loginDatetime type as datetime 
# and pass datetime with timezone
loginDatetimezone: datetime
---
~  2020-01-31T10:34:55.675+05:30
~  20200131T103855.324+0530

The date and time must be complete such as YYYY-MM-DDTHH:mm:ss.SSS or YYYYMMDDTHHmmssSSS before providing timezone.

MemberDef

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.

Last updated