[#BloombergLP-bdlt-Datetime-validateAndSetDatetime] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::validateAndSetDatetime :relfileprefix: ../../../ :mrdocs: Set the "date" part of this object's value to the specified `year`, `month`, and `day`, and the "time" part to the optionally specified `hour`, `minute`, `second`, and `millisecond`, if they represent a valid `Datetime` value, with trailing fields that are not specified set to 0. Return 0 on success, and a non‐zero value (with no effect) otherwise. == Synopsis Declared in `<bdlt_datetime.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int validateAndSetDatetime( int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0); ---- == Description DEPRECATED: Use `setDatetimeIfValid` instead. [.small]#Created with https://www.mrdocs.com[MrDocs]#