Skip to content

Instantly share code, notes, and snippets.

@yannvery
Created September 4, 2014 15:26
Show Gist options
  • Select an option

  • Save yannvery/4e66a12c1823d44c9201 to your computer and use it in GitHub Desktop.

Select an option

Save yannvery/4e66a12c1823d44c9201 to your computer and use it in GitHub Desktop.
Pure Ruby DateTime conversion to local timezone
#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