[#BloombergLP-bdlt-Datetime-addHoursIfValid]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::addHoursIfValid
:relfileprefix: ../../../
:mrdocs:

Add the specified number of `hours` to the value of this object, adjusting the &quot;date&quot; part of the object accordingly, if the resulting value is in the valid range for a `Datetime` object&period; If `24 &equals;&equals; hour()` on entry, set the `hour` attribute to 0 before performing the addition&period; Return 0 on success, and a non&hyphen;zero value (with no effect) otherwise&period; Note that `hours` may be positive, negative, or 0&period;

== Synopsis

Declared in `&lt;bdlt&lowbar;datetime&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
addHoursIfValid(xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] hours);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
