[#BloombergLP-bdlt-Datetime-addTimeIfValid] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::addTimeIfValid :relfileprefix: ../../../ :mrdocs: Add the specified number of `hours`, and the optionally specified number of `minutes`, `seconds`, `milliseconds`, and `microseconds` to the value of this object, adjusting the "date" part of this object accordingly, if the resulting value is in the valid range for a `Datetime` object. Unspecified trailing optional parameters default to 0. If `24 == hour()` on entry, set the `hour` attribute to 0 before performing the addition. Return 0 on success, and a non‐zero value (with no effect) otherwise. Note that each argument independently may be positive, negative, or 0. == Synopsis Declared in `<bdlt_datetime.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int addTimeIfValid( xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] hours, xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] minutes = 0, xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] seconds = 0, xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] milliseconds = 0, xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] microseconds = 0); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#