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

This value&hyphen;semantic class describes a datetime value in a particular time zone, which is indicated using an offset from UTC (in minutes)&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class DatetimeTz;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/DatetimeTz/2constructor-086.adoc[`DatetimeTz`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlt/DatetimeTz/2destructor.adoc[`&#126;DatetimeTz`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlt/DatetimeTz/operator_assign.adoc[`operator&equals;`] 
| Assign to this object the value of the specified `rhs` object, and return a reference providing modifiable access to this object&period;
| xref:BloombergLP/bdlt/DatetimeTz/bdexStreamIn.adoc[`bdexStreamIn`] 
| Assign to this object the value read from the specified input `stream` using the specified `version` format, and return a reference to `stream`&period; If `stream` is initially invalid, this operation has no effect&period; If `version` is not supported, this object is unaltered and `stream` is invalidated, but otherwise unmodified&period; If `version` is supported but `stream` becomes invalid during this operation, this object has an undefined, but valid, state&period; Note that no version is read from `stream`&period; See the `bslx` package&hyphen;level documentation for more information on BDEX streaming of value&hyphen;semantic types and containers&period;
| xref:BloombergLP/bdlt/DatetimeTz/bdexStreamOut.adoc[`bdexStreamOut`] 
| Write the value of this object, using the specified `version` format, to the specified output `stream`, and return a reference to `stream`&period; If `stream` is initially invalid, this operation has no effect&period; If `version` is not supported, `stream` is invalidated, but otherwise unmodified&period; Note that `version` is not written to `stream`&period; See the `bslx` package&hyphen;level documentation for more information on BDEX streaming of value&hyphen;semantic types and containers&period;
| xref:BloombergLP/bdlt/DatetimeTz/dateTz.adoc[`dateTz`] 
| Return a `DateTz` object having the value of the local date and offset represented by this object&period;
| xref:BloombergLP/bdlt/DatetimeTz/gmtDatetime.adoc[`gmtDatetime`] 
| Return a `Datetime` object having the value of the UTC datetime represented by this object&period; Note that if `0 !&equals; offset()`, the returned value is equal to `localDatetime()` minus `offset()` minutes, and `localDatetime()` otherwise&period;
| xref:BloombergLP/bdlt/DatetimeTz/localDatetime.adoc[`localDatetime`] 
| Return a `Datetime` object having the value of the local datetime represented by this object&period; Note that the `Datetime` value returned is the current value stored in this object and may be different from the local datetime of the system&period;
| xref:BloombergLP/bdlt/DatetimeTz/offset.adoc[`offset`] 
| Return the time zone offset of this `DatetimeTz` object&period; Note that the offset is in minutes from UTC&period;
| xref:BloombergLP/bdlt/DatetimeTz/print.adoc[`print`] 
| Write the value of this object to the specified output `stream` in a human&hyphen;readable format, and return a reference to `stream`&period; Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested objects&period; If `level` is specified, optionally specify `spacesPerLevel`, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects&period; If `level` is negative, suppress indentation of the first line&period; If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`)&period; If `stream` is not valid on entry, this operation has no effect&period; Note that the format is not fully specified, and can change without notice&period;
| xref:BloombergLP/bdlt/DatetimeTz/setDatetimeTz.adoc[`setDatetimeTz`] 
| Set the local datetime and the time zone offset of this object to the specified `localDatetime` and `offset` values respectively&period; The behavior is undefined unless all of the specified values are within their valid ranges (see `isValid`)&period; Note that this method provides no validation, and it is the user&apos;s responsibility to assure the consistency of the resulting value&period;
| xref:BloombergLP/bdlt/DatetimeTz/setDatetimeTzIfValid.adoc[`setDatetimeTzIfValid`] 
| If the specified `localDatetime` and `offset` represent a valid `DatetimeTz` value (see `isValid`), set the local datetime and the time zone offset of this object to the `localDatetime` and `offset` values respectively and return 0, leave this object unmodified and return a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/bdlt/DatetimeTz/timeTz.adoc[`timeTz`] 
| Return a `TimeTz` object having the value of the local time and offset represented by this object&period;
| xref:BloombergLP/bdlt/DatetimeTz/utcDatetime.adoc[`utcDatetime`] 
| Return a `Datetime` object having the value of the UTC datetime represented by this object&period; Note that if `0 !&equals; offset()`, the returned value is equal to `localDatetime()` minus `offset()` minutes, and `localDatetime()` otherwise&period;
| xref:BloombergLP/bdlt/DatetimeTz/validateAndSetDatetimeTz.adoc[`validateAndSetDatetimeTz`] 
| If the specified `localDatetime` and `offset` represent a valid `DatetimeTz` value (see `isValid`), set the local datetime and the time zone offset of this object to the `localDatetime` and `offset` values respectively and return 0, leave this object unmodified and return a non&hyphen;zero value otherwise&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/DatetimeTz/isValid.adoc[`isValid`] 
| Return `true` if the specified `localDatetime` and the specified time zone `offset` represent a valid `DatetimeTz` value, and `false` otherwise&period; A `localDatetime` and `offset` represent a valid `DatetimeTz` value if either `bdlt&colon;&colon;Time() &equals;&equals; localDatetime&period;time()` and `0 &equals;&equals; offset`, or `bdlt&colon;&colon;Time() !&equals; localDatetime&period;time()` and `offset` is in the range `( &hyphen;1440 &period;&period; 1440 )`&period; Note that a `true` result from this function does not guarantee that `offset` corresponds to any geographical or historical time zone&period; Also note that a `true` result from this function does not guarantee that `localDatetime` itself is a valid `Datetime` object&period;
| xref:BloombergLP/bdlt/DatetimeTz/maxSupportedBdexVersion-0a.adoc[`maxSupportedBdexVersion`] 
| `maxSupportedBdexVersion` overloads
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/operator_not_eq-082.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` and `rhs` `DatetimeTz` objects do not have the same value, and `false` otherwise&period; Two `DatetimeTz` objects do not have the same value if they do not have the same local datetime value or the same time zone offset value&period;
| xref:BloombergLP/bdlt/operator_eq-00b.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` and `rhs` `DatetimeTz` objects have the same value, and `false` otherwise&period; Two `DatetimeTz` objects have the same value if they have the same local datetime value and the same time zone offset value&period;
|===


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