[#BloombergLP-bdlt-DatetimeUtil-fromYmdHms]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/DatetimeUtil.adoc[DatetimeUtil]::fromYmdHms
:relfileprefix: ../../../
:mrdocs:

Return an `optional` having a `Datetime` with the specified `year`, `month`, `day`, `hour`, `minute`, `second`, and the optionally specified `millisecond` and `microsecond`, if those form a valid `Datetime` (see `Datetime&colon;&colon;isValid`)&semi; otherwise return an `optional` without a value&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:bsl/optional-072.adoc[bsl::optional&lt;Datetime&gt;]
fromYmdHms(
    int year,
    int month,
    int day,
    int hour,
    int minute,
    int second,
    int millisecond = 0,
    int microsecond = 0);
----


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