刚才太2了。。

在试验DateTime#since函数,就是给当前时间加一定的秒数。于是在Rails的命令行里面开始敲

>> puts DateTime.now #表示打印当前时间
2008-08-15T16:38:49+08:00
>> puts DateTime.now.since(1) #表示打印当前时间加1秒
2008-08-15T16:38:54+08:00

嗯,为啥相差了五秒而不是1秒呢。。

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.