The OpenD Programming Language

Timestamp.fromString

Creates a Timestamp from a string.

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

Parameters

str const(C)[]

A string formatted in the way that .Timestamp.toISOExtString and .Timestamp.toISOString format dates, also YAML like spaces seprated strings are accepted. The function is case sensetive.

value Timestamp

(optional) result value.

Return Value

Type: bool

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