加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Ruby 1.9.3中如何获得今天的日期?

发布时间:2020-12-16 21:49:18 所属栏目:百科 来源:网络整理
导读:我使用 Ruby 1.9.3,当我执行Date.today时,我得到NoM??ethodError:undefined methodtoday’for Date:Class` 我很困惑,因为它似乎是在documentation.虽然我知道这是2.0的文档,但我看到的答案可以追溯到1.8.7中实现.这是在1.9中删除吗? 解决方法 你需要“约
我使用 Ruby 1.9.3,当我执行Date.today时,我得到NoM??ethodError:undefined methodtoday’for Date:Class`

我很困惑,因为它似乎是在documentation.虽然我知道这是2.0的文档,但我看到的答案可以追溯到1.8.7中实现.这是在1.9中删除吗?

解决方法

你需要“约会”吗?
> require 'date'
 => true
> Date.today
 => #<Date: 2013-03-12 ((2456364j,0s,0n),+0s,2299161j)>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读