るりまサーチ

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

別のキーワード

  1. rss date
  2. rss date=
  3. date rfc3339
  4. date iso8601
  5. date jisx0301

ライブラリ

クラス

キーワード

検索結果

Date#year -> Integer (35102.0)

年を返します。

年を返します。

Date#next_year(n = 1) -> Date (23269.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 (23269.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 (23101.0)

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

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

Date#deconstruct_keys(array_of_names_or_nil) -> Hash (17025.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:...

絞り込み条件を変える

DateTime#deconstruct_keys(array_of_names_or_nil) -> Hash (11013.0)

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

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

キーに利用できる名前は以下の通りです。

* :year
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :sec_fraction
* :zone

@param array_of_names_or_nil パターンマッチに使...
...case dt
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 dt in DateTime(wday: 1...

Time#strftime(format) -> String (199.0)

時刻を format 文字列に従って文字列に変換した結果を返します。

...m,pm)
* %p: 午前または午後(AM,PM)
* %Q: 1970-01-01 00:00:00 UTC からの経過ミリ秒 (Time#strftime は対応していませんが、Date#strftime で使えます)
* %R: 24時間制の時刻。%H:%M と同等。
* %r: 12時間制の時刻。%I:%M:%S %p と同等。
* %S: 秒(00-...
...ロンが入った秒まで含むUTCからのオフセット (例 +09:00:00)
* %%: %自身
* %+: date(1)の形式 (%a %b %e %H:%M:%S %Z %Y) (Time#strftime は対応していませんが、Date#strftime で使えます)

このメソッドは strftime(3) や glibcの仕様を参考に作成され...
...ndar date (basic)
p t.strftime("%F") # => 2001-02-03 Calendar date (extended)
p t.strftime("%Y-%m") # => 2001-02 Calendar date, reduced accuracy, specific month
p t.strftime("%Y") # => 2001 Calendar date, re...