[#BloombergLP-bdlt-Datetime-setTimeIfValid] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::setTimeIfValid :relfileprefix: ../../../ :mrdocs: Set the time part from fields if they form a valid time. == Synopsis Declared in `<bdlt_datetime.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int setTimeIfValid( int hour, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); ---- == Description Set the "time" part of this object to have the value represented by the specified `hour` attribute value and the optionally specified `minute`, `second`, `millisecond`, and `microsecond` attribute values if they comprise a valid "time" portion of a `DateTime` value. Unspecified trailing optional parameters default to 0. Return 0 on success, and a non‐zero value (with no effect) otherwise. Note that this method has no effect on the "date" part of this object. == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *hour* | hour attribute | *minute* | minute attribute (default 0) | *second* | second attribute (default 0) | *millisecond* | millisecond attribute (default 0) | *microsecond* | microsecond attribute (default 0) |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#