BloombergLP::bdlt::Datetime::isValid

Return true if the specified attributes represent a valid Datetime.

Synopsis

Declared in <bdlt_datetime.h>

static
bool
isValid(
    int year,
    int month,
    int day,
    int hour = 0,
    int minute = 0,
    int second = 0,
    int millisecond = 0,
    int microsecond = 0);

Description

Return true if the specified year, month, and day attribute values, and the optionally specified hour, minute, second, millisecond, and microsecond attribute values, represent a valid Datetime value, and false otherwise. Unspecified trailing optional parameters default to 0. year, month, day, hour, minute, second, millisecond, and microsecond attribute values represent a valid Datetime value if true == Date::isValidYearMonthDay(year, month, day), 0 <= hour < 24, 0 <= minute < 60, 0 <= second < 60, 0 <= millisecond < 1000, and 0 <= microsecond < 1000. Additionally, a valid year, month, day with the time portion equal to 24:00:00.000000 also represents a valid Datetime value.

Return Value

true if the attributes form a valid Datetime

Parameters

NameDescription
yearyear attribute
monthmonth attribute
dayday-of-month attribute
hourhour attribute (default 0)
minuteminute attribute (default 0)
secondsecond attribute (default 0)
millisecondmillisecond attribute (default 0)
microsecondmicrosecond attribute (default 0)