1

I have Time object which I've created

t = Time.parse("Sat Nov 01 2014 00:00:00 GMT-0400 (EDT)")

I would like to shift the time_zone of t to be represented in the `GMT -0500" timezone.

Just to for clarity, I want the new t to become "Fri Oct 31 2014 23:00:00 GMT-0500 (EST)".

Please let me know if you need anymore information to answer. This timezone stuff gets seriously confusing. :)

wuliwong
  • 4,238
  • 9
  • 41
  • 69
  • Related, but not direct duplicates: http://stackoverflow.com/questions/16818180/ruby-rails-how-do-i-change-the-timezone-of-a-time-without-changing-the-time and http://stackoverflow.com/q/4467781/405017 – Phrogz Nov 06 '14 at 17:48
  • Thank you for including the clear output that you would like. Please let me know if the questions that I have marked as duplicates and related do not answer your question. – Phrogz Nov 06 '14 at 17:52
  • This one is really close http://stackoverflow.com/questions/4467781/how-do-i-alter-the-timezone-of-a-datetime-in-ruby but it is for the `DateTime` object. It is a different method for the `Time` object. I think it's probably legitimate to leave this question open. – wuliwong Nov 06 '14 at 19:42
  • Although I think I have the time shift backwards. I think it shifts it to "Fri Oct 31 2014 23:00:00 GMT-500 (EST)". – wuliwong Nov 06 '14 at 19:44
  • What I am looking for is achieved by applying the `in_time_zone` method to the instance of the `Time` object that you want to shift. – wuliwong Nov 06 '14 at 19:45
  • So, I really think this shouldn't be marked as a duplicate the more I think about it. This question is for an entirely different Class and Method than the one that it is marked as a duplicate. If someone was working with Time, like I am, instaed of DateTime, then the answer for the question that this is marked as a duplicate of wouldn't help them at all. – wuliwong Nov 10 '14 at 01:55

0 Answers0