Module: Kernel

Defined in:
lib/aplo/strptime.rb

Instance Method Summary collapse

Instance Method Details

#strptime(str, fmt) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/aplo/strptime.rb', line 29

def strptime(str, fmt)
  time = strptime_c(str, fmt)

  # Most C strptime implementations don't handle timezones.
  if fmt =~ / %z$/ && str =~ / ([-+:a-z0-9]+(?:\s+dst\b)?)$/io
    time + Date.zone_to_diff($1)
  else
    time
  end
end