Is there a simple way to convert Epoch time to standard format with Ruby? If so can I customize the way it is displayed?
Use the Time.at
method:
Time.at(1234567890) #=> 2009-02-13 16:31:30 -0700
To display the time, you can use the method strftime
on the resulting object.
For instance:
Time.at(1234567890).strftime("%m/%d/%Y") #=> "02/13/2009"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With