るりまサーチ

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

別のキーワード

  1. date year
  2. date prev_year
  3. date next_year
  4. time year
  5. _builtin year

ライブラリ

キーワード

検索結果

Date#year -> Integer (18103.0)

年を返します。

年を返します。

Date#next_year(n = 1) -> Date (6121.0)

n 年後を返します。

...相当します。

//emlist[例][ruby]{
require 'date'
Date
.new(2001,2,3).next_year #=> #<Date: 2002-02-03 ...>
Date
.new(2008,2,29).next_year #=> #<Date: 2009-02-28 ...>
Date
.new(2008,2,29).next_year(4) #=> #<Date: 2012-02-29 ...>
//}

Date
#>> も参照してください。

@param n 年...

Date#prev_year(n = 1) -> Date (6121.0)

n 年前を返します。

...相当します。

//emlist[例][ruby]{
require 'date'
Date
.new(2001,2,3).prev_year #=> #<Date: 2000-02-03 ...>
Date
.new(2008,2,29).prev_year #=> #<Date: 2007-02-28 ...>
Date
.new(2008,2,29).prev_year(4) #=> #<Date: 2004-02-29 ...>
//}

Date
#<< も参照してください。

@param n 年...

Date#cwyear -> Integer (6102.0)

暦週における年を返します。

暦週における年を返します。

Date#deconstruct_keys(array_of_names_or_nil) -> Hash (14.0)

パターンマッチに使用する名前と値の Hash を返します。

...下の通りです。

* :year
* :month
* :day
* :yday
* :wday

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
d = Date.new(2022, 10, 5)

if d in...
...case d
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day in month 10" が出力される

# クラスのチェックと組み合わせて利用することもできます
if d in Date(wday: 3, day:...

絞り込み条件を変える