1 unstable release
0.1.0 | Nov 5, 2024 |
---|
#223 in Date and time
118 downloads per month
10KB
100 lines
Timezone Converter
A Rust library for handling timezone conversions and retrieving timezone information with ease. This library wraps around chrono
and chrono-tz
to provide a simple interface for working with timezones.
Features
- Convert times between any supported timezone
- Get current time in different timezones
- Retrieve timezone information (name, offset, DST status)
- Calculate time differences between timezones
- Error handling for invalid timezones and conversion failures
Installation
Add this to your Cargo.toml
:
[dependencies]
timezone-converter = "0.1.0"
chrono = "0.4"
chrono-tz = "0.8"
lib.rs
:
Timezone Converter
A Rust library for converting times between different timezones and getting timezone information. This library provides functionality to:
- Convert times between any two timezones
- Get current time in different timezones
- Get timezone information including offset and DST status
- Calculate time differences between timezones
Example
use timezone_converter::TimeZoneConverter;
let converter = TimeZoneConverter::new("America/New_York", "Europe/London").unwrap();
let current_time = converter.get_current_time_source().unwrap();
let converted_time = converter.convert(current_time).unwrap();
Dependencies
~1.4–2.1MB
~28K SLoC