Timestamp.fromString

Creates a Timestamp from a string with the format YYYY-MM-DD, YYYYMMDD, or YYYY-Mon-DD.

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

Parameters

str const(C)[]

A string formatted in the way that .Timestamp.toISOExtString and .Timestamp.toISOString format dates. The function is case sensetive.

Return Value

Type: Timestamp

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

Throws

DateTimeException if the given string is not in the correct format. Two arguments overload is nothrow.

Examples

assert(Timestamp.fromString("2010-07-04") == Timestamp(2010, 7, 4));
assert(Timestamp.fromString("20100704") == Timestamp(2010, 7, 4));

Meta