るりまサーチ

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

別のキーワード

  1. rss date=
  2. rss date
  3. date iso8601
  4. date rfc3339
  5. date jisx0301

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

DateTime.now(start = Date::ITALY) -> DateTime (29302.0)

現在の時刻に相当する日時オブジェクトを生成します。

現在の時刻に相当する日時オブジェクトを生成します。

@param start グレゴリオ暦をつかい始めた日をあらわすユリウス日

DateTime (14028.0)

日付だけでなく時刻も扱える Date のサブクラスです。

...だけでなく時刻も扱える Date のサブクラスです。

Date
Time は deprecated とされているため、
Timeを使うことを推奨します。

=== 簡単なつかいかた

require 'date'

a = DateTime.new(1993, 2, 24, 12, 30, 45)
b = DateTime.parse('1993-02-24T12:30:45')...
...b += 10

b - a #=> 10
b.year #=> 1993
b.strftime('%a') #=> "Sat"

yesterday = DateTime.now - 1...

DateTime.today(start = Date::ITALY) -> Date (11208.0)

このクラスでは利用できません。

...このクラスでは利用できません。

Date
Time.now を参照してください。

@param start グレゴリオ暦をつかい始めた日をあらわすユリウス日...

CGI.rfc1123_date(time) -> String (6113.0)

与えられた時刻を 1123 フォーマットに準拠した文字列に変換します。

...与えられた時刻を 1123 フォーマットに準拠した文字列に変換します。

@param time Time のインスタンスを指定します。

例:
require "cgi"

CGI.rfc1123_date(Time.now)
# => Sat, 1 Jan 2000 00:00:00 GMT...

DateTime#to_json(*args) -> String (3006.0)

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

...のまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

Date
Time.now.to_json
# => "{\"json_class\":\"DateTime\",\"y\":2018,\"m\":12,\"d\":10,\"H\":1,\"M\":28,\"S\":57,\"of\":\"3/8\",\"sg\":2299161.0}"
//}

@see JSON::Generator::G...

絞り込み条件を変える

Time.parse(date, now = Time.now) -> Time (402.0)

...

date
Date._parse によって
パースして Timeオブジェクトに変換します。

ブロック付きで呼ばれた場合、dateの年はブロックによって変換されます。

require 'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}

与えられ...
...れていた場合、now
該当要素が使われます。

require 'time'
time = Time.local(2019, 5, 1)
Time.parse("12:00", time) #=> 2019-05-01 12:00:00 +0900

下位の要素がなかったり壊れていた場合、最小値(1か0)が使われます。

@param date Time オブジェ...
...クトに変換可能な文字列を指定します。
@param now 現在時刻をTime オブジェクトで指定します。
デフォルトはTime.nowとなります。

@raise ArgumentError dateに空文字列を与えた場合、発生します。
なお、1.9.2...

Time.parse(date, now = Time.now) {|year| year } -> Time (402.0)

...

date
Date._parse によって
パースして Timeオブジェクトに変換します。

ブロック付きで呼ばれた場合、dateの年はブロックによって変換されます。

require 'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}

与えられ...
...れていた場合、now
該当要素が使われます。

require 'time'
time = Time.local(2019, 5, 1)
Time.parse("12:00", time) #=> 2019-05-01 12:00:00 +0900

下位の要素がなかったり壊れていた場合、最小値(1か0)が使われます。

@param date Time オブジェ...
...クトに変換可能な文字列を指定します。
@param now 現在時刻をTime オブジェクトで指定します。
デフォルトはTime.nowとなります。

@raise ArgumentError dateに空文字列を与えた場合、発生します。
なお、1.9.2...

Time.strptime(date, format, now=self.now) -> Time (334.0)

文字列を Date._strptime を用いて Time オブジェクト に変換します。

...文字列を Date._strptime を用いて Time オブジェクト
に変換します。

require 'time'
Time.strptime('2001-02-03T04:05:06+09:00', '%Y-%m-%dT%H:%M:%S%z')
#=> 2001-02-03 06:05:06 +0900

ブロックを渡すと年の部分をブロックによって変換できます。
require...
...me('01/5/18 4:13:00', '%Y/%m/%d %T'){|y|
if y > 100 then y
elsif y >= 69 then y + 1900
else y + 2000
end
}
#=> 2001-05-18 04:13:00 +0900

詳しくは DateTime.strptime, Date.strptime を見てください。

@param date 時刻を表す文字列
@param format 書式文字列...

Time.strptime(date, format, now=self.now) {|y| ... } -> Time (334.0)

文字列を Date._strptime を用いて Time オブジェクト に変換します。

...文字列を Date._strptime を用いて Time オブジェクト
に変換します。

require 'time'
Time.strptime('2001-02-03T04:05:06+09:00', '%Y-%m-%dT%H:%M:%S%z')
#=> 2001-02-03 06:05:06 +0900

ブロックを渡すと年の部分をブロックによって変換できます。
require...
...me('01/5/18 4:13:00', '%Y/%m/%d %T'){|y|
if y > 100 then y
elsif y >= 69 then y + 1900
else y + 2000
end
}
#=> 2001-05-18 04:13:00 +0900

詳しくは DateTime.strptime, Date.strptime を見てください。

@param date 時刻を表す文字列
@param format 書式文字列...

NEWS for Ruby 3.0.0 (204.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...rguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the...
...3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}

* Pattern matching (`case/in...
...e-limit` option

The `--backtrace-limit` option limits the maximum length of a backtrace.
8661

== Core classes updates

Outstanding ones only.

* Array
* The following methods now return Array instances instead of subclass instances when called on subclass instances: 6087
* Array#drop...

絞り込み条件を変える

<< 1 2 > >>