#include <bdlt_datetimetz.h>
This value-semantic class describes a datetime value in a particular time zone, which is indicated using an offset from UTC (in minutes).
See bdlt_datetimetz
◆ DatetimeTz() [1/3]
| bdlt::DatetimeTz::DatetimeTz |
( |
| ) |
|
|
inline |
Create a DatetimeTz object having the (default) attribute values:
Datetime localDatetime() const
Definition bdlt_datetimetz.h:660
int offset() const
Definition bdlt_datetimetz.h:666
Definition bdlt_datetime.h:331
◆ DatetimeTz() [2/3]
| bdlt::DatetimeTz::DatetimeTz |
( |
const Datetime & |
localDatetime, |
|
|
int |
offset |
|
) |
| |
|
inline |
Create a DatetimeTz object having a local datetime value equal to the specified localDatetime and a time zone offset value from UTC equal to the specified offset (in minutes). The behavior is undefined unless all of the specified values are within their valid ranges (see isValid). Note that this method provides no validation, and it is the user's responsibility to ensure that offset represents a valid time zone and that localDatetime represents a valid datetime in that time zone.
◆ DatetimeTz() [3/3]
| bdlt::DatetimeTz::DatetimeTz |
( |
const DatetimeTz & |
original | ) |
|
|
inline |
Create a DatetimeTz object having the same value as the specified original object.
◆ ~DatetimeTz()
| bdlt::DatetimeTz::~DatetimeTz |
( |
| ) |
|
|
inline |
◆ bdexStreamIn()
template<class STREAM >
| STREAM & bdlt::DatetimeTz::bdexStreamIn |
( |
STREAM & |
stream, |
|
|
int |
version |
|
) |
| |
Assign to this object the value read from the specified input stream using the specified version format, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, this object is unaltered and stream is invalidated, but otherwise unmodified. If version is supported but stream becomes invalid during this operation, this object has an undefined, but valid, state. Note that no version is read from stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.
◆ bdexStreamOut()
template<class STREAM >
| STREAM & bdlt::DatetimeTz::bdexStreamOut |
( |
STREAM & |
stream, |
|
|
int |
version |
|
) |
| const |
Write the value of this object, using the specified version format, to the specified output stream, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, stream is invalidated, but otherwise unmodified. Note that version is not written to stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.
◆ dateTz()
| DateTz bdlt::DatetimeTz::dateTz |
( |
| ) |
const |
|
inline |
Return a DateTz object having the value of the local date and offset represented by this object.
◆ gmtDatetime()
| Datetime bdlt::DatetimeTz::gmtDatetime |
( |
| ) |
const |
|
inline |
◆ isValid()
| bool bdlt::DatetimeTz::isValid |
( |
const Datetime & |
localDatetime, |
|
|
int |
offset |
|
) |
| |
|
inlinestatic |
Return true if the specified localDatetime and the specified time zone offset represent a valid DatetimeTz value, and false otherwise. A localDatetime and offset represent a valid DatetimeTz value if either bdlt::Time() == localDatetime.time() and 0 == offset, or bdlt::Time() != localDatetime.time() and offset is in the range ( -1440 .. 1440 ). Note that a true result from this function does not guarantee that offset corresponds to any geographical or historical time zone. Also note that a true result from this function does not guarantee that localDatetime itself is a valid Datetime object.
◆ localDatetime()
| Datetime bdlt::DatetimeTz::localDatetime |
( |
| ) |
const |
|
inline |
Return a Datetime object having the value of the local datetime represented by this object. 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.
◆ maxSupportedBdexVersion() [1/2]
| int bdlt::DatetimeTz::maxSupportedBdexVersion |
( |
| ) |
|
|
inlinestatic |
◆ maxSupportedBdexVersion() [2/2]
| int bdlt::DatetimeTz::maxSupportedBdexVersion |
( |
int |
versionSelector | ) |
|
|
inlinestatic |
Return the maximum valid BDEX format version, as indicated by the specified versionSelector, to be passed to the bdexStreamOut method. Note that it is highly recommended that versionSelector be formatted as "YYYYMMDD", a date representation. Also note that versionSelector should be a compile-time-chosen value that selects a format version supported by both externalizer and unexternalizer. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.
◆ offset()
| int bdlt::DatetimeTz::offset |
( |
| ) |
const |
|
inline |
Return the time zone offset of this DatetimeTz object. Note that the offset is in minutes from UTC.
◆ operator=()
Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.
◆ print()
| bsl::ostream & bdlt::DatetimeTz::print |
( |
bsl::ostream & |
stream, |
|
|
int |
level = 0, |
|
|
int |
spacesPerLevel = 4 |
|
) |
| const |
Write the value of this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. 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. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.
◆ setDatetimeTz()
| void bdlt::DatetimeTz::setDatetimeTz |
( |
const Datetime & |
localDatetime, |
|
|
int |
offset |
|
) |
| |
|
inline |
Set the local datetime and the time zone offset of this object to the specified localDatetime and offset values respectively. The behavior is undefined unless all of the specified values are within their valid ranges (see isValid). Note that this method provides no validation, and it is the user's responsibility to assure the consistency of the resulting value.
◆ setDatetimeTzIfValid()
| int bdlt::DatetimeTz::setDatetimeTzIfValid |
( |
const Datetime & |
localDatetime, |
|
|
int |
offset |
|
) |
| |
|
inline |
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-zero value otherwise.
◆ timeTz()
| TimeTz bdlt::DatetimeTz::timeTz |
( |
| ) |
const |
|
inline |
Return a TimeTz object having the value of the local time and offset represented by this object.
◆ utcDatetime()
| Datetime bdlt::DatetimeTz::utcDatetime |
( |
| ) |
const |
|
inline |
◆ validateAndSetDatetimeTz()
| int bdlt::DatetimeTz::validateAndSetDatetimeTz |
( |
const Datetime & |
localDatetime, |
|
|
int |
offset |
|
) |
| |
|
inline |
- Deprecated:
- replaced by
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-zero value otherwise.
The documentation for this class was generated from the following file: