Created
September 4, 2014 15:26
-
-
Save yannvery/4e66a12c1823d44c9201 to your computer and use it in GitHub Desktop.
Pure Ruby DateTime conversion to local timezone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Simply to do this with rails but how to with ruby only | |
| #Parse | |
| dt = DateTime.parse(issue.updated_at.to_s) | |
| # Convert | |
| local_dt = dt.new_offset(DateTime.now.offset) | |
| # Display | |
| local_dt.strftime("%I:%M %p - %d-%b-%Y") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment