pub fn in_named_or(
default: TimeZoneRef<'_>,
tz: impl AsRef<[u8]>,
) -> Result<DateTime, NowError>
Expand description
Get the current time in a given time zone, by name, or default to some static time zone
§Errors
Possible errors include:
- The current Unix time could not be determined.
- The current Unix time could not be projected into the time zone. Most likely the system time is off, or you are a time traveler trying run this code a few billion years in the future or past.
§Example
// What is the time in Some City?
let now = tzdb::now::in_named_or(tzdb::time_zone::GMT, "Some/City")?;
§See also:
- [
local()
] / [local_or()
] in_named()
/in_named_or()
in_tz()