Get timezone offset in seconds for a given UTC datetime
(&self, utc_dt: &DateTime<Utc>)
| 134 | |
| 135 | /// Get timezone offset in seconds for a given UTC datetime |
| 136 | fn offset_seconds(&self, utc_dt: &DateTime<Utc>) -> i32 { |
| 137 | match self { |
| 138 | TimezoneType::Named(tz) => { |
| 139 | let tz_dt = utc_dt.with_timezone(tz); |
| 140 | tz_dt.offset().fix().local_minus_utc() |
| 141 | } |
| 142 | TimezoneType::Fixed(offset) => offset.local_minus_utc(), |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /// AT TIME ZONE operator: converts datetime to specified timezone |