本文簡要介紹ruby語言中  Date.d   的用法。
用法
d <=> other → -1, 0, +1 or nil
比較兩個日期並返回 -1、零、1 或 nil。另一個應該是日期對象或作為天文儒略日數的數值。
Date.new(2001,2,3) <=> Date.new(2001,2,4)   #=> -1
Date.new(2001,2,3) <=> Date.new(2001,2,3)   #=> 0
Date.new(2001,2,3) <=> Date.new(2001,2,2)   #=> 1
Date.new(2001,2,3) <=> Object.new           #=> nil
Date.new(2001,2,3) <=> Rational(4903887,2)  #=> 0
另見 Comparable 。
相關用法
- Ruby Date.d << n用法及代碼示例
 - Ruby Date.d ===用法及代碼示例
 - Ruby Date.d + other用法及代碼示例
 - Ruby Date.d >>用法及代碼示例
 - Ruby Date.d - other用法及代碼示例
 - Ruby Date.day用法及代碼示例
 - Ruby Date.day_fraction用法及代碼示例
 - Ruby Date.valid_civil?用法及代碼示例
 - Ruby Date.gregorian?用法及代碼示例
 - Ruby Date.strftime用法及代碼示例
 - Ruby Date.valid_ordinal?用法及代碼示例
 - Ruby Date.leap?用法及代碼示例
 - Ruby Date.today用法及代碼示例
 - Ruby Date.mday用法及代碼示例
 - Ruby Date.next_year用法及代碼示例
 - Ruby Date.strptime用法及代碼示例
 - Ruby Date.to_s用法及代碼示例
 - Ruby Date.parse用法及代碼示例
 - Ruby Date.civil用法及代碼示例
 - Ruby Date.cwyear用法及代碼示例
 - Ruby Date.yday用法及代碼示例
 - Ruby Date.julian?用法及代碼示例
 - Ruby Date._parse用法及代碼示例
 - Ruby Date.prev_year用法及代碼示例
 - Ruby Date.jisx0301用法及代碼示例
 
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Date.d <=>。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
