today = Time.now
=> 2014-01-12 22:24:39 -0500
future = Time.parse("01-03-2014")
=> 2014-03-01 00:00:00 -0500
"%2.f" % ((future - today)/60/60/24)
=> 47
How else can I get 47 days without having to do /60/60/24
?
如果没有/ 60/60/24,我怎么能得到47天?
1 个解决方案
#1
0
You could compare two dates.
你可以比较两个日期。
today = Date.today
future = Date.parse("01-03-2014")
days_diff = (future - today).to_i
#1
0
You could compare two dates.
你可以比较两个日期。
today = Date.today
future = Date.parse("01-03-2014")
days_diff = (future - today).to_i