`
java-admin
  • 浏览: 1364928 次
  • 性别: Icon_minigender_1
  • 来自: 陕西.西安
社区版块
存档分类
最新评论

1.minute 和 1.hour 、1.month 是什么意思?

 
阅读更多

It's a little trick that Rails adds to Ruby

 

 

1、切换到 rails console 下

2、运行:

1.hour => 3600 seconds
1.hour.class => Fixnum

 

+++++++++++++++++++++++++++++++++++++++++++

 

E:\awe\awe-source-code\awe-server-code\awe-server\awe>rails console
Loading development environment (Rails 3.0.9)
irb(main):001:0> 1.hour
=> 3600 seconds
irb(main):002:0> 1.hour.class
=> Fixnum
irb(main):003:0> 1.minute
=> 60 seconds

 

++++++++++++++++++++++++++++++++++++++++++++

 

irb(main):014:0> 1.hour.from_now
=> Mon, 10 Oct 2011 09:00:41 UTC +00:00
irb(main):015:0> 1.hour.from_now.class
=> ActiveSupport::TimeWithZone
irb(main):016:0>

 

  • 大小: 59.9 KB
分享到:
评论

相关推荐

    Java课程设计案例经编

    System.out.print(mycalendar1.get(Calendar.MONTH) + "月"); System.out.println(mycalendar1.get(Calendar.DATE) + "日"); System.out.println("今日时间: "); System.out.print(mycalendar1.get...

    Java课程设计案例精编

    System.out.print(mycalendar1.get(Calendar.MONTH) + "月"); System.out.println(mycalendar1.get(Calendar.DATE) + "日"); System.out.println("今日时间: "); System.out.print(mycalendar1.get...

    MS Excel 函数手册

    1 1. 函数和公式 ................................................................................................................ 1 [1]. 什么是函数 .......................................................

    Excel2003常用函数完全手册 CHM格式 带全文检索

    9.MONTH............................. 5 10.NETWORKDAYS ........... 5 11.NOW..........…................... 6 12.SECOND..….................... 6 13.TIME.........…................... 6 14.TIME...

    BOS V6.2开发指南_扩展报表函数参考手册

    1 公式向导 ...................................................................................................................................... 4 2 函数参考 ............................................

    Asp.NetFunctionCollection.rar_4 3 2 1_毫秒 年月日

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime() 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now 1.2 取当前年 int 年=currentTime.Year 1.3 取当前月 int 月=currentTime....

    java基础题目 java面试题

    int month = c.get(Calendar.MONTH)+1; int day = c.get(Calendar.DATE); int hour = c.get(Calendar.HOUR); int minute = c.get(Calendar.MINUTE); int second = c.get(Calendar.SECOND); 如何取得从...

    mysql 日期函数.txt

    1. 2.DAYOFWEEK(date) 3.WEEKDAY(date) 4.DAYOFMONTH(date) 5.DAYOFYEAR(date) 6.MONTH(date) 7.DAYNAME(date) 8.MONTHNAME(date) 9.QUARTER(date) 10.WEEK(date) WEEK(date,first) 11.YEAR(date) 12.HOUR(time) 13....

    crontab命令

     {minute} {hour} {day-of-month} {month} {day-of-week} {full-path-to-shell-script}  o minute:区间为 0 – 59  o hour:区间为0 – 23  o day-of-month:区间为0 – 31  o month:区间...

    各类监听合集

    Log.e("time_now", ""+year+"_"+month+1+"_"+day+"_"+hour+"_"+minute); SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss"); Date curDate = new Date(System.currentTimeMillis...

    c#.net常用函数列表.doc

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

    C#.net常用函数和方法集

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

    android时间控件

    public void onCreate(Bundle savedInstanceState) { super.onCreate... mHour = c.get(Calendar.HOUR_OF_DAY); mMinute = c.get(Calendar.MINUTE); setDateTime(); setTimeOfDay(); }

    C#函数方法集 DataTable,DataView和DataGrid中一些容易混淆的概念,数据库连接大全

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

    C# 常用 函数 列表

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

    C#函数方法集(经典)TmT

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

    c#.net常用函数列表

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

    ASP.NET程序中常用的三十三种代码.txt

     /// 格式后的异常信息字符串,包括异常内容和跟踪堆栈.  ///  ///  public static String FormatException(Exception ex, String catchInfo)  {  StringBuilder strBuilder = new StringBuilder();  if ...

    html页面时间使用

    获取和格式化时间实用笔记1.日期格式化 Date.prototype.format = function(format) { var o = { "M+" : this.getMonth()+1, //month "d+" : this.getDate(), //day "h+" : this.getHours(), //hour "m+" : ...

    C#_的字符串处理函数及举例

    1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=...

Global site tag (gtag.js) - Google Analytics