The OpenD Programming Language

Timestamp.fromString

Creates a Timestamp from a string.

  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
    )

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.

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