Skip to content

Instantly share code, notes, and snippets.

@leejaew
Created September 23, 2013 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leejaew/6676698 to your computer and use it in GitHub Desktop.
Save leejaew/6676698 to your computer and use it in GitHub Desktop.
convert unix timestamp to readable format in ruby
# sample unix timestamp
unix_timestamp = 1379967844
# create a new time object with the value
#
# Time.at(value)
t = Time.at(unix_timestamp)
# get current system time
#
# t = Time.now() # => get current time #
puts t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment