るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.023秒)

別のキーワード

  1. time rfc2822
  2. time iso8601
  3. time httpdate
  4. time parse
  5. time strptime

ライブラリ

検索結果

Time#<=>(other) -> -1 | 0 | 1 | nil (81451.0)

self と other の時刻を比較します。self の方が大きい場合は 1 を、等しい場合は 0 を、 小さい場合は -1 を返します。比較できない場合は、nil を返します。

...たい時刻を Time オブジェクトで指定します。

//emlist[][ruby]{
p t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p t2 = t + 2592000 # => 2000-01-31 00:00:00 +0900
p t <=> t2 # => -1
p t2 <=> t # => 1
//}

//emlist[][ruby]{
p t = Time.local(2000)...