[#BloombergLP-bdlt-DateUtil-fromYmd]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/DateUtil.adoc[DateUtil]::fromYmd
:relfileprefix: ../../../
:mrdocs:

Return a `Date` for `year`&sol;`month`&sol;`day` if valid&semi; otherwise empty&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:bsl/optional-072.adoc[bsl::optional&lt;Date&gt;]
fromYmd(
    int year,
    int month,
    int day);
----

== Description

Return an `optional` having a `Date` with the specified `year`, `month`, and `day`, if those form a valid `Date` (see `Date&colon;&colon;isValid`)&semi; otherwise return an `optional` without a value&period;

== Return Value

optional date, empty if the YMD is invalid

== Parameters

[cols="1,4"]
|===
| Name| Description
| *year*
| calendar year
| *month*
| month of year
| *day*
| day of month
|===


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