[#BloombergLP-bdlt-DatetimeInterval-setIntervalIfValid]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/DatetimeInterval.adoc[DatetimeInterval]::setIntervalIfValid
:relfileprefix: ../../../
:mrdocs:

Set this time interval to the specified field values if valid&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
setIntervalIfValid(
    int days,
    xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] hours = 0,
    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);
----

== Description

Set the time interval represented by this object to the value given by the specified `days`, and the optionally specified `hours`, `minutes`, `seconds`, `milliseconds`, and `microseconds`&period; Unspecified arguments default to 0&period; Return 0 if the resulting time interval value is valid (i&period;e&period;, the `days` field must not overflow an `int`) and a non&hyphen;zero value (with no effect) otherwise&period; Note that the arguments may be supplied using a mixture of positive, negative, and 0 values&period;

== Return Value

0 on success, and a non&hyphen;zero value (with no effect) otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *days*
| day count
| *hours*
| hour count (optional)
| *minutes*
| minute count (optional)
| *seconds*
| second count (optional)
| *milliseconds*
| millisecond count (optional)
| *microseconds*
| microsecond count (optional)
|===


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