[#BloombergLP-bdlt-Time-validateAndSetTime]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Time.adoc[Time]::validateAndSetTime
:relfileprefix: ../../../
:mrdocs:

Set this time from fields if they form a valid value&semi; otherwise do nothing&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
validateAndSetTime(
    int hour,
    int minute = 0,
    int second = 0,
    int millisecond = 0);
----

== Description

Set the value of this time object to the specified `hour`, and the optionally specified `minute`, `second`, and `millisecond`, if they would comprise a valid `Time` value (see `isValid`)&period; Return 0 on success, and a non&hyphen;zero value (with no effect) otherwise&period; Unspecified arguments default to 0&period;

DEPRECATED&colon; Use `setTimeIfValid` instead&period;

== Return Value

0 on success, and a non&hyphen;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)
|===


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