0
我希望做类似:有没有办法将更多小时链接到日期?
Date.today.at_beginning_of_month.to_time.+2.hours.to_i
当我包括
.to_i
方法我不明白的UNIX时间,我要找的。
我希望做类似:有没有办法将更多小时链接到日期?
Date.today.at_beginning_of_month.to_time.+2.hours.to_i
当我包括
.to_i
方法我不明白的UNIX时间,我要找的。
.to_i绑定到2.hours表达式,导致Fixnum(7200)。向Time对象添加Fixnum可以获得另一个Time对象。
裹在括号为所期望的结果的表达:
(Date.today.at_beginning_of_month.to_time + 2.hours).to_i
如何简单。非常感谢。 – ghal