るりまサーチ

最速Rubyリファレンスマニュアル検索!
148件ヒット [1-100件を表示] (0.030秒)
トップページ > クエリ:date[x] > クエリ:month[x]

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Date#month -> Integer (32101.0)

月を返します (1-12)。

月を返します (1-12)。

Date#next_month(n = 1) -> Date (23208.0)

n ヶ月後を返します。

...n ヶ月後を返します。

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

@param n 月数...

Date#prev_month(n = 1) -> Date (23208.0)

n ヶ月前を返します。

...n ヶ月前を返します。

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

@param n 月数...

Date#<<(n) -> Date (17215.0)

self より n ヶ月前の日付オブジェクトを返します。 n は数値でなければなりません。

...date'
Date
.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...>
Date
.new(2001,2,3) << -2 #=> #<Date: 2001-04-03 ...>
//}

対応する月に同じ日が存在しない時は、代わりにその月の末日が使われます。

//emlist[][ruby]{
require 'date'
Date
.new(2001,3,28) << 1 #=> #<Date...
...01-02-28 ...>
Date
.new(2001,3,31) << 1 #=> #<Date: 2001-02-28 ...>
//}

このことは以下のように、もしかすると予期しない振る舞いをするかもしれません。

//emlist[][ruby]{
require 'date'
Date
.new(2001,3,31) << 2 #=> #<Date: 2001-01-31 ...>
Date
.new(2001,3,...
...31) << 1 << 1 #=> #<Date: 2001-01-28 ...>

Date
.new(2001,3,31) << 1 << -1 #=> #<Date: 2001-03-28 ...>
//}

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

@param n 月数...

Date#>>(n) -> Date (17215.0)

self から n ヶ月後の日付オブジェクトを返します。 n は数値でなければなりません。

...ruby]{
require 'date'
Date
.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...>
Date
.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...>
//}


対応する月に同じ日が存在しない時は、代わりにその月の末日が使われます。

//emlist[][ruby]{
require 'date'
Date
.new(2001,1,28)...
...01-02-28 ...>
Date
.new(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...>
//}

このことは以下のように、もしかすると予期しない振る舞いをするかもしれません。

//emlist[][ruby]{
require 'date'
Date
.new(2001,1,31) >> 2 #=> #<Date: 2001-03-31 ...>
Date
.new(2001,1,...
...31) >> 1 >> 1 #=> #<Date: 2001-03-28 ...>

Date
.new(2001,1,31) >> 1 >> -1 #=> #<Date: 2001-01-28 ...>
//}

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

@param n 月数...

絞り込み条件を変える

Date#deconstruct_keys(array_of_names_or_nil) -> Hash (17066.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 wday:...
...
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される

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: ..7)
puts "first Wednesday of the month"
end
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Date#mon -> Integer (17001.0)

月を返します (1-12)。

月を返します (1-12)。

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

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

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

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

//emlist[例][ruby]{
dt = DateTime...
...: ...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..5, hour: 10..18...
..., day: ..7)
puts "Working time, first week of the month"
end
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Time#httpdate -> String (6138.0)

2616 で定義されている HTTP-date の rfc1123-date 形式の文字列を 返します。

...2616 で定義されている HTTP-date の rfc1123-date 形式の文字列を
返します。

@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss GMT
//}
注意: 結果はいつも UTC (GMT) です。

使用例
require 'time'

is...
...o8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.httpdate #=> "Sun, 31 Aug 2008 03:34:56 GMT"...

Time#strftime(format) -> String (198.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...

絞り込み条件を変える

<< 1 2 > >>