LogoLogo
  • Internet Object 1.0
  • Internet Object
    • Abstract
    • The Poetic Principles of Internet Object
    • Objectives
    • Introducing Internet Object
  • The Structure
    • Internet Object Document
      • Header
      • Data Sections
    • Structural Elements
      • Structural Characters and Literals
      • Literals
      • Other Special Characters
      • Whitespaces
    • Values Representations
      • Objects
      • Arrays
      • Strings
        • Open Strings
        • Regular Strings
        • Raw Strings
      • Numeric Values
        • Number
        • BigInt
        • Decimal
        • Special Numeric Integer Formats
          • Hexadecimal
          • Octal
          • Binary
        • NaN and Infinity
      • Binary
      • Date and Time
      • Booleans
      • Nulls
    • Comments
    • Encoding
  • The Collections
    • Collection
    • Creating Collection
    • Collection Rules
    • Data Streaming
  • The Definitions
    • Definitions
    • Variables
    • Complex Schema
  • Schema Definition Language
    • Internet Object Schema
    • The structure
    • Data Types
      • Any
      • String
        • String Derived Types
          • Email
          • URL
          • Date
          • Time
          • DateTime
      • Number
        • Derived Types
          • int
          • byte
          • int16
          • int32
      • Object
      • Array
      • Bool
    • Dynamic Schema
    • Is Object, a MemberDef or a Schema?
  • Other
    • Best Practices
    • FAQs
    • Contributors
    • License
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Schema Definition Language
  2. Data Types
  3. String
  4. String Derived Types

Date

PreviousURLNextTime

Last updated 4 years ago

Was this helpful?

Derived from String, the Internet Object Date is an ISO 8601 compatible date format. It can be represented as YYYY-MM-DD or YYYYMMDD i.e It can be passed with or without separators (- U+002D).

The Date Structure

Value

Description

Optional

Default

Example

YYYY

Four-digit decimal number

(0000-9999)

No

-

2020

MM

two-digit decimal number (01-12)

Yes

01

04

DD

two-digit decimal number (01-31)

Yes

01

30

The value for the year must be provided as it does not takes any default value.

It prescribes a minimum four-digit year format from a range 0000 to 9999 to avoid the year 2000 problem. However, years from a range 1583 to 9999 are automatically allowed by a standard, while years prior to 1583 can only be used by mutual agreement of the partners in information interchange.

Date with separators:

Date without Separators:

YYYY-MM-DD = 2020-02-17

YYYYMMDD = 20200217

YYYY-MM = 2020-02

YYYYMM = 202002

YYYY = 2020

YYYY = 2020

Here is the code snippet demonstrates, how to define and use date type.

# Defining date for registeredDate
registeredDate: date
---
~ 2020-09-17    
~ 20200917      # parsed as 2020-09-17
~ 2020-09       # parsed as 2020-09-01
~ 2019          # parsed as 2019-01-01

MemberDef

The Date is derived from the String type, hence it shares the same as the String. However, Date enforces additional constraints with respective date format and the same is applicable to the Date MemberDef.

MemberDef