Date.fromISOExtString

Creates a Date from a string with the format YYYY-MM-DD. Whitespace is stripped from the given string.

struct Date
static @safe pure
fromISOExtString
(
S
)
(
scope const S isoExtString
)

Parameters

isoExtString S

A string formatted in the ISO Extended format for dates.

Throws

std.datetime.date.DateTimeException if the given string is not in the ISO Extended format or if the resulting Date would not be valid.

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));
assert(Date.fromISOExtString(" 2010-07-04 ") == Date(2010, 7, 4));

Meta