Module: TimeZoneExt

Defined in:
lib/time_zone_ext.rb,
lib/time_zone_ext/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Instance Method Details

#strptime(date, format) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/time_zone_ext.rb', line 6

def strptime(date, format)
  if format =~ /%z/i
    DateTime.strptime(date, format).in_time_zone
  else
    DateTime.strptime("#{date} zone#{formatted_offset}", "#{format} zone%z").in_time_zone
  end
end