BloombergLP::bdlt::DatetimeUtil::fromYmdHms

Return an optional Datetime built from the specified clock fields.

Synopsis

Declared in <bdlt_datetimeutil.h>

static
bsl::optional<Datetime>
fromYmdHms(
    int year,
    int month,
    int day,
    int hour,
    int minute,
    int second,
    int millisecond = 0,
    int microsecond = 0);

Description

Return an optional having a Datetime with the specified year, month, day, hour, minute, second, and the optionally specified millisecond and microsecond, if those form a valid Datetime (see Datetime::isValid); otherwise return an optional without a value.

Return Value

optional containing a valid Datetime, or empty if invalid

Parameters

NameDescription
yearcalendar year
monthmonth of year
dayday of month
hourhour of day
minuteminute of hour
secondsecond of minute
millisecondoptional millisecond
microsecondoptional microsecond