The OpenD Programming Language

fromISOExtString

Creates a Date from a string with the format YYYY-MM-DD.

  1. bool fromISOExtString(const(C)[] str, Date value)
  2. Date fromISOExtString(const(C)[] str)
    @safe pure @nogc static @safe pure
    Date
    fromISOExtString
    (
    C
    )
    (
    scope const(C)[] str
    )

Parameters

str const(C)[]

A string formatted in the way that .date.toISOExtString 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.fromISOExtString("2010-07-04") == Date(2010, 7, 4));
assert(Date.fromISOExtString("1998-12-25") == Date(1998, 12, 25));
assert(Date.fromISOExtString("0000-01-05") == Date(0, 1, 5));
assert(Date.fromISOExtString("-0004-01-05") == Date(-4, 1, 5));

Meta