[#BloombergLP-bdlt-Datetime-setDatetimeIfValid-03] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::setDatetimeIfValid :relfileprefix: ../../../ :mrdocs: `setDatetimeIfValid` overloads == Synopses Declared in `<bdlt_datetime.h>` Set this object to `date` and optional time fields if valid. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int xref:BloombergLP/bdlt/Datetime/setDatetimeIfValid-02.adoc[setDatetimeIfValid]( xref:BloombergLP/bdlt/Date.adoc[Date] const& date, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); ---- [.small]#xref:BloombergLP/bdlt/Datetime/setDatetimeIfValid-02.adoc[_» more..._]# Set this object from calendar fields if they form a valid datetime. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int xref:BloombergLP/bdlt/Datetime/setDatetimeIfValid-0b.adoc[setDatetimeIfValid]( int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); ---- [.small]#xref:BloombergLP/bdlt/Datetime/setDatetimeIfValid-0b.adoc[_» more..._]# == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *date* | date part to set | *hour* | hour attribute (default 0) | *minute* | minute attribute (default 0) | *second* | second attribute (default 0) | *millisecond* | millisecond attribute (default 0) | *microsecond* | microsecond attribute (default 0) | *year* | year attribute | *month* | month attribute | *day* | day‐of‐month attribute |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#