require 'date'
require 'time'
--> Fri May 02 16:50:08 +0800 2008
Time.now.strftime('%Y-%m-%d')
--> "2008-05-02"
SECOND_IN_A_DAY
兩個時間相減得到的單位是秒
Date.today:
%Y, %y: year
%b, %B: month
%m : month(number)
%d, %e: day of month
%a, %A: dat name( such as Tue)
%H, %I: hour
%M: minute
%S: second
%c: equals "%a %b %d %H:%M:%S %Y"
%x: equals "%m/%d/%y"
沒有留言:
張貼留言