Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 683 Bytes

convert-a-unix-epoch-timestamp-to-a-time-object.md

File metadata and controls

18 lines (14 loc) · 683 Bytes

Convert A Unix Epoch Timestamp To A Time Object

Ruby's Time class has an #at method that allows you get the time at a certain unix epoch timestamp. That timestamp is an integer value representing the number of seconds since the unix epoch. While it is a handy way to store that data, it is hard to tell what time it represents at a glance.

Time.at(1669652477)
=> 2022-11-28 10:21:17 -0600

Using Time.at we are able to turn that integer into a Time object that represents the date and time in a human-readable way.

source