Struct datetime::TimeZone [] [src]

pub struct TimeZone(pub TimeZoneSource<'static>);

A time zone, which here is a list of timespans, each containing a fixed offset for the current location’s time from UTC.

Methods

impl TimeZone
[src]

Returns the total offset from UTC, in seconds, that this time zone has at the given datetime.

Returns the time zone abbreviation that this time zone has at the given datetime. As always, abbreviations are notoriously vague, and should only be used when referring to a known timezone.

Whether this time zone is “fixed”: a fixed time zone has no transitions, meaning it will always be at the same offset from UTC.

There are relatively few of these, namely the European timezones WET, CET, MET, and EET, and the North American timezones EST5EDT, CST6CDT, MST7MDT, and PST8PDT, none of which actually corresponds to a geographical location.

Converts a local datetime in UTC to a zoned datetime that uses this time zone.

Converts a local datetime that is already informally in this time zone into a zoned datetime that actually uses this time zone.

For example, say you have the current time for a time zone, but you don’t know what the current offset from UTC is. This method computes the offset, then subtracts rather than adds it, resulting in a value that gets displayed as the current time. In other words, calling hour() or year() or any of the other view methods on one of the resulting values will always return the same as the datetime initially passed in, no matter what the current offset is.

This method can return 0, 1, or 2 values, depending on whether the datetime passed in falls between two timespans (an impossible time) or overlaps two separate timespans (an ambiguous time). The result will almost always be precise, but there are edge cases you need to watch out for.

Trait Implementations

impl Debug for TimeZone
[src]

Formats the value using the given formatter.

impl Clone for TimeZone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more