require 'date' DateTime.now.strftime('%s') # "1384526946" (seconds) DateTime.now.strftime('%Q') # "1384526946523" (milliseconds)