I’m trying to output the timezone of a ruby DateTime object:
DateTime.parse('2012/05/23').strftime('%Z')
This outputs "+00:00". According to the documentation, it should return GMT.
Am I doing something wrong, or have I found a bug?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
DateTimeclass does not seem to support zone data as zone names. TheTimeclass however does this correctly. So either do this:Or if you already have your data in
DateTimeformat then: