1.day #=> 86400
2.days #=> 172800
Time.now.to_i #=> 1334222062
Time.at(1334222062) #=> 2012-04-12 18:14:22 +0900
Time.at(1334222062) + 1.day #=> 2012-04-13 18:14:22 +0900
Time.at(1334222062).to_s(:db) #=> "2012-04-12 18:14:22"
Time::DATE_FORMATS[:date_ordinal] = lambda { |time| time.strftime("%b #{time.day.ordinalize} %Y") }
Time.at(1334222062).to_s(:date_ordinal) #=> "Apr 12th 2012"
Time.local(2012, 4, 12) #=> 2012-04-12 00:00:00 +0900
Time.now.beginning_of_day #=> 2012-04-12 00:00:00 +0900
Time.now.end_of_day #=> 2012-04-12 23:59:59 +0900
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
10