Skip to content

Instantly share code, notes, and snippets.

@plentz
Created June 1, 2011 20:04
Show Gist options
  • Save plentz/1003175 to your computer and use it in GitHub Desktop.
Save plentz/1003175 to your computer and use it in GitHub Desktop.
ruby-1.9.2-p180 :002 > require 'time'
=> true
ruby-1.9.2-p180 :003 > Time.now.httpdate
=> "Wed, 01 Jun 2011 20:03:43 GMT"
ruby-1.9.2-p180 :004 > puts Time.httpdate("Wed, 01 Jun 2011 20:03:43 GMT")
2011-06-01 17:03:43 -0300
=> nil
@felipediesel
Copy link

O Ruby converte pro teu timezone no to_s da classe Time.

Se tu usares Time.httpdate("Wed, 01 Jun 2011 20:03:43 GMT").utc vai retornar a data no fuso horário GMT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment