Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I want to get the GMT time in the rfc1123 format (Tue, 15 Nov 1994 08:12:31 GMT)
- # Here is what I do
- # getting GMT time
- 1.9.3-p429 :063 > datetime = DateTime.now.new_offset(0)
- => #<DateTime: 2013-07-30T10:34:52+00:00 ((2456504j,38092s,886243436n),+0s,2299161j)>
- # but this below returns the local time :/
- 1.9.3-p429 :064 > datetime = DateTime.now.new_offset(0).to_time
- => 2013-07-30 12:34:59 +0200
- 1.9.3-p429 :065 > puts datetime.strftime("%a, %d %b %Y %H:%M:%S")
- Tue, 30 Jul 2013 12:34:59 # <-- wrong..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement