Converting Ruby timestamp to seconds in Epoch and back

Supposing your timestamp is a Ruby Time object:

puts time_stamp.strftime('%s')
puts time_stamp.to_i
timestamp = Time.at(628232400)

In case it is a DateTime object, you have the strftime and strptime methods at your disposal.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)