るりまサーチ

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

別のキーワード

  1. date year
  2. date prev_year
  3. date next_year
  4. time year
  5. _builtin year

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Time#year -> Integer (18108.0)

年を整数で返します。

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

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

Date#year -> Integer (18102.0)

年を返します。

年を返します。

Date#next_year(n = 1) -> Date (6120.0)

n 年後を返します。

...2) に相当します。

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

Date#prev_year(n = 1) -> Date (6120.0)

n 年前を返します。

...2) に相当します。

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

Date#cwyear -> Integer (6101.0)

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

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

絞り込み条件を変える

MatchData#byteoffset(name) -> [Integer, Integer] | [nil, nil] (19.0)

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

...ない name を指定した場合に発生します。

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

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

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

...いない name を指定した場合に発生します。

//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]...

Psych::ScalarScanner#tokenize(string) -> object (13.0)

YAML の scalar である文字列を Ruby のオブジェクトに変換した ものを返します。

...YAML の scalar である文字列を Ruby のオブジェクトに変換した
ものを返します。

scanner = Psych::ScalarScanner.new
p scanner.tokenize("yes") # => true
p scanner.tokenize("year") # => "year"
p scanner.tokenize("12") # => 12

@param string 変換文字列...

Time#to_a -> Array (13.0)

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

...(整数 0-60) (60はうるう秒)
* min: 分 (整数 0-59)
* hour: 時 (整数 0-23)
* mday: 日 (整数)
* mon: 月 (整数 1-12)
* year: 年 (整数 2000年=2000)
* wday: 曜日 (整数 0-6)
* yday: 年内通算日 (整数 1-366)
* isdst: 夏時間であるかどうか (tr...
...C 言語の tm 構造体に合わせています。ただし、
tm 構造体に zone はありません。

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

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

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

...dar date, reduced accuracy, specific month
p t.strftime("%Y") # => 2001 Calendar date, reduced accuracy, specific year
p t.strftime("%C") # => 20 Calendar date, reduced accuracy, specific century
p t.strftime("%Y%j")...

絞り込み条件を変える

<< 1 2 > >>