種類
- インスタンスメソッド (216)
- クラス (12)
- 定数 (12)
キーワード
- << (12)
- == (12)
- >> (12)
-
RFC822
_ MONTHS (12) - Time (12)
-
backtrace
_ locations (12) - byteoffset (6)
-
deconstruct
_ keys (6) - httpdate (12)
- mon (24)
-
next
_ month (12) - offset (24)
-
prev
_ month (12) - rfc2822 (12)
- rfc822 (12)
- strftime (12)
-
to
_ a (12)
検索結果
先頭5件
-
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") #...