fromISOString

Creates a Date from a string with the format YYYYMMDD.

  1. bool fromISOString(const(C)[] str, Date value)
  2. Date fromISOString(const(C)[] str)
    static @safe pure
    fromISOString
    (
    C
    )
    (
    scope const(C)[] str
    )
    if (
    isSomeChar!C
    )

Parameters

str const(C)[]

A string formatted in the way that .date.toISOString formats dates.

Return Value

Type: Date

bool on success for two arguments overload, and the resulting date for single argument overdload.

Throws

DateTimeException if the given string is not in the correct format or if the resulting Date would not be valid. Two arguments overload is nothrow.

Examples

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

Meta