るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. _builtin *
  2. matrix *
  3. array *
  4. vector *
  5. bigdecimal *

ライブラリ

キーワード

検索結果

Date#to_json(*args) -> String (307.0)

自身を JSON 形式の文字列に変換して返します。

...args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

//emlist[例][ruby]{
require "json/add/core"

Date
.today.to_json
# => "{\"json_class\":\"Date\",\"y\":2018,\"m\":12,\"d\":11,\"sg\":2299161.0}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

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

n 年後を返します。

...相当します。

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

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

n 年前を返します。

...相当します。

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