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

Set this object to the specified `date` and optional time fields&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
setDatetime(
    xref:BloombergLP/bdlt/Date.adoc[Date] const& date,
    int hour = 0,
    int minute = 0,
    int second = 0,
    int millisecond = 0,
    int microsecond = 0);
----

== Description

Set the value of this object to a `Datetime` whose &quot;date&quot; part has the value represented by the specified `date`, and whose &quot;time&quot; part has the value represented by the optionally specified `hour`, `minute`, `second`, `millisecond`, and `microsecond` attributes&period; Unspecified trailing optional parameters default to 0&period; The behavior is undefined unless the attributes (collectively) represent a valid `Datetime` value (see `isValid`)&period;

== 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)
|===


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