[#BloombergLP-baltzo-TimeZoneUtilImp-initLocalTime]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baltzo.adoc[baltzo]::xref:BloombergLP/baltzo/TimeZoneUtilImp.adoc[TimeZoneUtilImp]::initLocalTime
:relfileprefix: ../../../
:mrdocs:

Initialize local time in `timeZoneId` from `localTime`&period;

== Synopsis

Declared in `&lt;baltzo&lowbar;timezoneutilimp&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
initLocalTime(
    xref:BloombergLP/bdlt/DatetimeTz.adoc[bdlt::DatetimeTz]* result,
    xref:BloombergLP/baltzo/LocalTimeValidity/Enum.adoc[LocalTimeValidity::Enum]* resultValidity,
    xref:BloombergLP/bdlt/Datetime.adoc[bdlt::Datetime] const& localTime,
    char const* timeZoneId,
    xref:BloombergLP/baltzo/DstPolicy/Enum.adoc[DstPolicy::Enum] dstPolicy,
    xref:BloombergLP/baltzo/ZoneinfoCache.adoc[ZoneinfoCache]* cache);
----

== Description

Load, into the specified `result`, the local date&hyphen;time value &hyphen;&hyphen; including the local date, time, and resolved UTC offset &hyphen;&hyphen; indicated by the specified `localTime` in the time zone indicated by the specified `timeZoneId`, using the specified `dstPolicy` to interpret whether or not `localTime` represents a daylight&hyphen;saving time value, and using time zone information supplied by the specified `cache`&period; Load, into the specified `resultValidity` the value indicating the whether `localTime` is unique, ambiguous but valid, or invalid&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; A return status of `ErrorCode&colon;&colon;k&lowbar;UNSUPPORTED&lowbar;ID` indicates that `timeZoneId` is not recognized&period; The behavior is undefined unless the result of the initialization falls within the supported epoch&period;

== Return Value

0 on success, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| receives the initialized local date&hyphen;time
| *resultValidity*
| receives the validity of `localTime`
| *localTime*
| local date&hyphen;time to interpret
| *timeZoneId*
| identifier of the time zone for `localTime`
| *dstPolicy*
| daylight&hyphen;saving policy for interpreting `localTime`
| *cache*
| zoneinfo cache supplying time zone data
|===


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