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

This utility `struct` provides a namespace for a suite of functions operating on objects of type `Datetime`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct DatetimeUtil;
----

== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/DatetimeUtil/convertFromTm.adoc[`convertFromTm`] 
| Load into the specified `result` the value of the specified `timeStruct`&period; Return 0 on success, and a non&hyphen;zero value with no effect on `result` if `timeStruct` is invalid or otherwise cannot be represented as a `Datetime`&period; Values in fields `tm&lowbar;wday`, `tm&lowbar;yday`, and `tm&lowbar;isdst` are ignored&period; The time 24&colon;00&colon;00 will be recognized, and leap seconds (i&period;e&period;, values in `tm&lowbar;sec` of 60 or 61) which can otherwise be represented as a `Datetime` will cause the conversion to succeed with the `result` &quot;rolling over&quot; into the zeroth second of next minute&period; Note that time zones are irrelevant for this conversion&period;
| xref:BloombergLP/bdlt/DatetimeUtil/convertToTm-0a.adoc[`convertToTm`] 
| Return or load into the specified `result` the value of the specified `datetime` expressed as a `bsl&colon;&colon;tm`&period; Each field in the result is set to its proper value except `tm&lowbar;isdst`, which is set to `&hyphen;1` to indicate that no information on daylight saving time is available&period; A time value of 24&colon;00&colon;00&colon;00 will be converted to 0&colon;00&colon;00&period; Note that time zones are irrelevant for this conversion&period;
| xref:BloombergLP/bdlt/DatetimeUtil/fromYmdHms.adoc[`fromYmdHms`] 
| 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;
|===



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