Ruby : Unix Time Stamp to Date/Time conversion

Time.at(DateTime.now.to_i)
 => 2016-02-19 17:58:52 +0545

DateTime.strptime(DateTime.now.to_i.to_s,'%s')
 => Fri, 19 Feb 2016 12:17:05 +0000

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s