I am trying to display this output, as a date:
1296524384
But when I call .to_date on it, I am getting this error:
undefined method `to_date' for 1296524384:Fixnum
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.
You can just do:
That gives you:
By the way,
1296524384is referred to as UNIX or epoch time. It measures the number of seconds elapsed since January 1, 1970.To format it a bit better, you can use Ruby’s
strftimemethod.More info here: http://apidock.com/ruby/DateTime/strftime