Class: BigqueryMigration::TimeWithZone
- Inherits:
-
Object
- Object
- BigqueryMigration::TimeWithZone
- Defined in:
- lib/bigquery_migration/time_with_zone.rb
Constant Summary collapse
- NUMERIC_PATTERN =
[+-]HH:MM, [+-]HHMM, [+-]HH
%r{\A[+-]\d\d(:?\d\d)?\z}
- NAME_PATTERN =
Region/Zone, Region/Zone/Zone
%r{\A[^/]+/[^/]+(/[^/]+)?\z}
Class Method Summary collapse
Class Method Details
.strptime_with_zone(date, format, timezone) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/bigquery_migration/time_with_zone.rb', line 16 def strptime_with_zone(date, format, timezone) time = Time.strptime(date, format) _utc_offset = time.utc_offset _zone_offset = zone_offset(timezone) time.localtime(_zone_offset) + _utc_offset - _zone_offset end |
.time_with_zone(time, timezone) ⇒ Object
12 13 14 |
# File 'lib/bigquery_migration/time_with_zone.rb', line 12 def time_with_zone(time, timezone) time.localtime(zone_offset(timezone)) end |