るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. date month
  2. date prev_month
  3. date next_month
  4. time month
  5. _builtin month

ライブラリ

キーワード

検索結果

Time#month -> Integer (45328.0)

月を整数で返します。

...月を整数で返します。

//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5) # => 2000-01-02 03:04:05 +0900
p t.month # => 1
p t.mon # => 1
//}...

Time#mon -> Integer (28.0)

月を整数で返します。

...月を整数で返します。

//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5) # => 2000-01-02 03:04:05 +0900
p t.month # => 1
p t.mon # => 1
//}...

Time#httpdate -> String (25.0)

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

...を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss GMT
//}
注意: 結果はいつも UTC (GMT) です。

使用例
require 'time'

iso8601_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#rfc2822 -> String (25.0)

2822 で定義されている date-time として表現される形式の文字列を 返します。

...されている date-time として表現される形式の文字列を
返します。

@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss zone
//}
ただし zone は [+-]hhmm です。
self が UTC time の場合、zone は +0...
...000 になります。

使用例
require 'time'

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

Time#rfc822 -> String (25.0)

2822 で定義されている date-time として表現される形式の文字列を 返します。

...されている date-time として表現される形式の文字列を
返します。

@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss zone
//}
ただし zone は [+-]hhmm です。
self が UTC time の場合、zone は +0...
...000 になります。

使用例
require 'time'

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

絞り込み条件を変える

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

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

...または午後(am,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 と同等...
...セット (例 +09:00:00)
* %%: %自身
* %+: date(1)の形式 (%a %b %e %H:%M:%S %Z %Y) (Time#strftime は対応していませんが、Date#strftime で使えます)

このメソッドは strftime(3) や glibcの仕様を参考に作成されており、以下のオプションが利用でき...
...uby]{
p t = Time.new(2001,2,3,4,5,6,"+09:00") # => 2001-02-03 04:05:06 +0900
p t.strftime("Printed on %m/%d/%Y") # => "Printed on 02/03/2001"
p t.strftime("Printed on %m/%-d/%_6Y") # => "Printed on 02/3/ 2001"
p t.strftime("at %I:%M%p") # => "at 04:05AM"
p t.strftime("at %I:%M...

Time#to_a -> Array (25.0)

時刻を10要素の配列で返します。

...内通算日 (整数 1-366)
* isdst: 夏時間であるかどうか (true/false)
* zone: タイムゾーン (文字列)

//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5)
p t # => 2000-01-02 03:04:05 +0900
p t.to_a # => [5, 4, 3, 2, 1, 2000, 0, 2, false, "JST"]
//}

要素の順序は C...