Skip to content

Instantly share code, notes, and snippets.

@ph3nx
Created January 16, 2014 08:36
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ph3nx/8451619 to your computer and use it in GitHub Desktop.
Save ph3nx/8451619 to your computer and use it in GitHub Desktop.
Handy method to get the current unix time stamp in Ruby. Unix time, or POSIX time, is a system for describing instants in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.
def timestamp
Time.now.to_i
end
@atanasna
Copy link

Works like a charm :) I've been using this for more than 4 years

@nnzo
Copy link

nnzo commented Aug 17, 2020

+1

This is perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment