189件ヒット
[1-100件を表示]
(0.036秒)
種類
- 特異メソッド (77)
- インスタンスメソッド (56)
- 文書 (23)
- ライブラリ (22)
- クラス (11)
ライブラリ
キーワード
- === (6)
- DateTime (11)
-
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - append (11)
- cover? (17)
- header (11)
- parse (22)
-
rfc1123
_ date (11) - rss (11)
-
ruby 1
. 6 feature (11) - strptime (22)
-
to
_ json (11) - today (11)
- tsort (11)
検索結果
先頭5件
-
DateTime
. now(start = Date :: ITALY) -> DateTime (29302.0) -
現在の時刻に相当する日時オブジェクトを生成します。
現在の時刻に相当する日時オブジェクトを生成します。
@param start グレゴリオ暦をつかい始めた日をあらわすユリウス日 -
DateTime (14028.0)
-
日付だけでなく時刻も扱える Date のサブクラスです。
...だけでなく時刻も扱える Date のサブクラスです。
DateTime は 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) -
このクラスでは利用できません。
...このクラスでは利用できません。
DateTime.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"
DateTime.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...