Date.toISOString

Converts this Date to a string with the format YYYYMMDD. If writer is set, the resulting string will be written directly to it.

  1. string toISOString()
    struct Date
    const @safe pure nothrow
    string
    toISOString
    ()
  2. void toISOString(W writer)

Return Value

Type: string

A string when not using an output range; void otherwise.

Examples

assert(Date(2010, 7, 4).toISOString() == "20100704");
assert(Date(1998, 12, 25).toISOString() == "19981225");
assert(Date(0, 1, 5).toISOString() == "00000105");
assert(Date(-4, 1, 5).toISOString() == "-00040105");

Meta