Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails convert unix timestamp to datetime

## Timestapms without leading zeros won't require the division by a thousand.
## If you do that you'll get 1970 as the date
## So instaed just run this

Time.at(1652276037)

 => "2022-05-11 13:33:57 +0000"

## From there just format as you wish to using :db or strftime
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rails #convert #unix #timestamp #datetime
ADD COMMENT
Topic
Name
2+4 =