[#BloombergLP-bdlt-Datetime-2constructor-06] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::Datetime :relfileprefix: ../../../ :mrdocs: Create a `Datetime` from year, month, day, and optional time fields. == Synopsis Declared in `<bdlt_datetime.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- Datetime( int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0); ---- == Description Create a `Datetime` object whose "date" part has the value represented by the specified `year`, `month`, and `day` attributes, and whose "time" part has the value represented by the optionally specified `hour`, `minute`, `second`, `millisecond`, and `microsecond` attributes. Unspecified trailing optional parameters default to 0. The behavior is undefined unless the eight attributes (collectively) represent a valid `Datetime` value (see `isValid`). == Parameters [cols="1,4"] |=== | Name| Description | *year* | year attribute | *month* | month attribute | *day* | day‐of‐month attribute | *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]#