[#absl-TimeZone]
= xref:absl.adoc[absl]::TimeZone
:relfileprefix: ../
:mrdocs:

The `absl&colon;&colon;TimeZone` is an opaque, small, value&hyphen;type class representing a geo&hyphen;political region within which particular rules are used for converting between absolute and civil times (see https&colon;&sol;&sol;git&period;io&sol;v59Ly)&period; `absl&colon;&colon;TimeZone` values are named using the TZ identifiers from the IANA Time Zone Database, such as &quot;America&sol;Los&lowbar;Angeles&quot; or &quot;Australia&sol;Sydney&quot;&period; `absl&colon;&colon;TimeZone` values are created from factory functions such as `absl&colon;&colon;LoadTimeZone()`&period; Note&colon; strings like &quot;PST&quot; and &quot;EDT&quot; are not valid TZ identifiers&period; Prefer to pass by value rather than const reference&period;

== Synopsis

Declared in `&lt;absl&sol;time&sol;time&period;h&gt;`

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

== Description

For more on the fundamental concepts of time zones, absolute times, and civil times, see https&colon;&sol;&sol;github&period;com&sol;google&sol;cctz&num;fundamental&hyphen;concepts

Examples&colon;

absl&colon;&colon;TimeZone utc &equals; absl&colon;&colon;UTCTimeZone()&semi; absl&colon;&colon;TimeZone pst &equals; absl&colon;&colon;FixedTimeZone(&hyphen;8 &ast; 60 &ast; 60)&semi; absl&colon;&colon;TimeZone loc &equals; absl&colon;&colon;LocalTimeZone()&semi; absl&colon;&colon;TimeZone lax&semi; if (!absl&colon;&colon;LoadTimeZone(&quot;America&sol;Los&lowbar;Angeles&quot;, &amp;lax)) &lcub; &sol;&sol; handle error case &rcub;

See also&colon;

* https&colon;&sol;&sol;github&period;com&sol;google&sol;cctz
* https&colon;&sol;&sol;www&period;iana&period;org&sol;time&hyphen;zones
* https&colon;&sol;&sol;en&period;wikipedia&period;org&sol;wiki&sol;Zoneinfo

== Types

[cols="1,4"]
|===
| Name| Description
| xref:absl/TimeZone/CivilInfo.adoc[`CivilInfo`] 
| Information about the civil time corresponding to an absolute time&period; This struct is not intended to represent an instant in time&period; So, rather than passing a `TimeZone&colon;&colon;CivilInfo` to a function, pass an `absl&colon;&colon;Time` and an `absl&colon;&colon;TimeZone`&period;
| xref:absl/TimeZone/CivilTransition.adoc[`CivilTransition`] 
| A transition in a time zone&colon; the civil times just before and after an offset change&period;
| xref:absl/TimeZone/TimeInfo.adoc[`TimeInfo`] 
| Information about the absolute times corresponding to a civil time&period; (Subseconds must be handled separately&period;)
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/TimeZone/2constructor-00.adoc[`TimeZone`]         [.small]#[constructor]#
| Constructors
| xref:absl/TimeZone/operator_assign.adoc[`operator&equals;`] 
| Assigns a copy of another time zone&period;
| xref:absl/TimeZone/At-05.adoc[`At`] 
| `At` overloads
| xref:absl/TimeZone/NextTransition.adoc[`NextTransition`] 
| Finds the next offset change in this time zone at or after a given time&period;
| xref:absl/TimeZone/PrevTransition.adoc[`PrevTransition`] 
| Finds the previous offset change in this time zone before a given time&period;
| xref:absl/TimeZone/name.adoc[`name`] 
| Returns the TZ identifier name of this time zone&period;
| xref:absl/TimeZone/2conversion.adoc[`operator &sol;&ast; implementation-defined &ast;&sol;::cctz::time&lowbar;zone`] 
| Converts this time zone to the underlying cctz time zone&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:absl/operator_lshift-032.adoc[absl::operator&lt;&lt;]`
| Writes the time zone&apos;s name to an output stream&period;
| `xref:absl/operator_not_eq-0e1.adoc[absl::operator!&equals;]`
| Returns whether two time zones are unequal&period;
| `xref:absl/operator_eq-0dc.adoc[absl::operator&equals;&equals;]`
| Returns whether two time zones are equal&period;
| `xref:absl/AbslHashValue-070.adoc[absl::AbslHashValue]`
| Combines this time zone into a hash state&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/FixedTimeZone.adoc[`FixedTimeZone`]
| Returns a TimeZone that is a fixed offset (seconds east) from UTC&period; Note&colon; If the absolute value of the offset is greater than 24 hours you&apos;ll get UTC (i&period;e&period;, no offset) instead&period;
| xref:absl/LocalTimeZone.adoc[`LocalTimeZone`]
| Convenience method returning the local time zone, or UTC if there is no configured local zone&period; Warning&colon; Be wary of using LocalTimeZone(), and particularly so in a server process, as the zone configured for the local machine should be irrelevant&period; Prefer an explicit zone name&period;
| xref:absl/UTCTimeZone.adoc[`UTCTimeZone`]
| Convenience method returning the UTC time zone&period;
|===


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