るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 3 > >>

MatchData#offset(name) -> [Integer, Integer] | [nil, nil] (18.0)

name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。

...生します。

//emlist[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.offset('year') # => [0, 4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $...

Time#mon -> Integer (7.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
//}...

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

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

...せん。

//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 (6.0)

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

...せん。

//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 月数...

Time (6.0)

時刻を表すクラスです。

...第4章を参照してください。

localtime(3) も参照してください。

=== C 言語との違いに注意

C 言語の tm 構造体とは異なり、month は 1 月に対
して 1 を返し、year は 1998 年に対して 1998 を返します。また、
yday は 1 から数えます。...

絞り込み条件を変える

Time#httpdate -> String (6.0)

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

...HTTP-date の rfc1123-date 形式の文字列を
返します。

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

使用例
require 'time'

iso8601_time = '2008-08-31T12:34:...

Time#rfc2822 -> String (6.0)

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

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

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

Time#rfc822 -> String (6.0)

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

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

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

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

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

...3 Calendar date (extended)
p t.strftime("%Y-%m") # => 2001-02 Calendar date, reduced accuracy, specific month
p t.strftime("%Y") # => 2001 Calendar date, reduced accuracy, specific year
p t.strftime("%C") #...
<< < 1 2 3 > >>