Offset (ZonedParsiDateTime) - parsicore/parsidate GitHub Wiki
offset
(on ZonedParsiDateTime)
Method Returns the UTC offset for this specific date and time.
Description
This method retrieves the UTC offset of the ZonedParsiDateTime
in its current timezone.
The offset represents the duration between the local time and UTC.
Important: The offset can vary for the same timezone depending on the date, due to rules such as Daylight Saving Time (DST).
Arguments
This method does not take any arguments.
Returns
Tz::Offset
: The UTC offset of this datetime in seconds or as a duration, depending on the timezone implementation.
Examples (Rust)
use parsidate::{ZonedParsiDateTime, Tz}; // Assuming these types exist
// In summer (DST), New York is UTC-4. Jalali month 4 is Tir.
let summer_time = ZonedParsiDateTime::new(1403, 4, 1, 10, 0, 0, New_York).unwrap();
assert_eq!(summer_time.offset().fix().local_minus_utc(), -4 * 3600); // -14400 seconds
// In winter (standard time), New York is UTC-5. Jalali month 10 is Dey.
let winter_time = ZonedParsiDateTime::new(1403, 10, 1, 10, 0, 0, New_York).unwrap();
assert_eq!(winter_time.offset().fix().local_minus_utc(), -5 * 3600); // -18000 seconds