956件ヒット
[1-100件を表示]
(0.062秒)
別のキーワード
種類
- インスタンスメソッド (709)
- 特異メソッド (247)
キーワード
- + (12)
- - (24)
- <=> (12)
- asctime (12)
- ctime (12)
- day (12)
- dst? (12)
- eql? (12)
- friday? (12)
- getgm (12)
- getlocal (24)
- getutc (12)
- gm (24)
- gmt? (12)
-
gmt
_ offset (12) - gmtime (12)
- gmtoff (12)
- hour (12)
- httpdate (24)
- inspect (6)
- isdst (12)
- iso8601 (24)
- local (24)
- localtime (24)
- mday (12)
- min (12)
- mktime (24)
- mon (12)
- monday? (12)
- month (12)
- new (31)
- now (12)
- nsec (12)
- parse (24)
- rfc2822 (24)
- rfc822 (24)
- round (12)
- saturday? (12)
- sec (12)
- strftime (12)
- strptime (24)
- subsec (12)
- succ (7)
- sunday? (12)
- thursday? (12)
-
to
_ a (12) -
to
_ f (12) -
to
_ i (12) -
to
_ r (12) -
to
_ s (12) - tuesday? (12)
-
tv
_ nsec (12) -
tv
_ sec (12) -
tv
_ usec (12) - usec (12)
- utc (36)
- utc? (12)
-
utc
_ offset (12) - wday (12)
- wednesday? (12)
- xmlschema (24)
- yday (12)
- year (12)
- zone (12)
検索結果
先頭5件
-
Time
# httpdate -> String (6107.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-31......T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.httpdate #=> "Sun, 31 Aug 2008 03:34:56 GMT"... -
Time
. httpdate(date) -> Time (6107.0) -
2616で定義されているHTTP-dateとしてdateをパースして Timeオブジェクトに変換します。
...いるHTTP-dateとしてdateをパースして
Timeオブジェクトに変換します。
dateが2616に準拠していない、または
Timeクラスが指定された日時を表現できないときにArgumentErrorが
発生します。
@param date 2616で定義されているHTTP-dateとし......は Timeクラスが指定された日時を表現できないときに発生します。
require 'time'
rfc2616_time = 'Sun, 31 Aug 2008 12:34:56 GMT'
t = Time.httpdate(rfc2616_time)
p t.kind_of?(Time) #=> true
non_rfc2616_time = 'San, 31 Aug 2008 12:34:56 GMT'
begin
Time.httpdat......e(non_rfc2616_time)
rescue ArgumentError => err
puts err #=> not RFC 2616 compliant date: "San, 31 Aug 2008 12:34:56 GMT"
end... -
Time
# inspect -> String (6101.0) -
時刻を文字列に変換した結果を返します。
...返します。
Time#to_s とは異なりナノ秒まで含めて返します。
//emlist[][ruby]{
t = Time.now
t.inspect #=> "2012-11-10 18:16:12.261257655 +0100"
t.strftime "%Y-%m-%d %H:%M:%S.%N %z" #=> "2012-11-10 18:16:12.261257655 +0100"
t.utc.inspect......#=> "2012-11-10 17:16:12.261257655 UTC"
t.strftime "%Y-%m-%d %H:%M:%S.%N UTC" #=> "2012-11-10 17:16:12.261257655 UTC"
//}
戻り値の文字エンコーディングは Encoding::US_ASCII です。... -
Time
. parse(date , now = Time . now) -> Time (6101.0) -
...date を Date._parse によって
パースして Timeオブジェクトに変換します。
ブロック付きで呼ばれた場合、dateの年はブロックによって変換されます。
require 'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
与えられ......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 (6101.0) -
...date を Date._parse によって
パースして Timeオブジェクトに変換します。
ブロック付きで呼ばれた場合、dateの年はブロックによって変換されます。
require 'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
与えられ......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 (6101.0) -
文字列を Date._strptime を用いて Time オブジェクト に変換します。
...trptime を用いて 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 'time'
Time.strpt......+0900
Time.strptime('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 f... -
Time
. strptime(date , format , now=self . now) {|y| . . . } -> Time (6101.0) -
文字列を Date._strptime を用いて Time オブジェクト に変換します。
...trptime を用いて 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 'time'
Time.strpt......+0900
Time.strptime('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 f... -
Time
# strftime(format) -> String (265.0) -
時刻を format 文字列に従って文字列に変換した結果を返します。
...時刻を format 文字列に従って文字列に変換した結果を返します。
@param format フォーマット文字列を指定します。使用できるものは 以下の通りです。
* %A: 曜日の名称(Sunday, Monday ... )
* %a: 曜日の省略名(Sun, Mon ... )
* %B: 月......%P: 午前または午後(am,pm)
* %p: 午前または午後(AM,PM)
* %Q: 1970-01-01 00:00:00 UTC からの経過ミリ秒 (Time#strftime は対応していませんが、Date#strftime で使えます)
* %R: 24時間制の時刻。%H:%M と同等。
* %r: 12時間制の時刻。%I:%M:%S %p......セット (例 +09:00:00)
* %%: %自身
* %+: date(1)の形式 (%a %b %e %H:%M:%S %Z %Y) (Time#strftime は対応していませんが、Date#strftime で使えます)
このメソッドは strftime(3) や glibcの仕様を参考に作成されており、以下のオプションが利用でき... -
Time
# wday -> Integer (85.0) -
曜日を0(日曜日)から6(土曜日)の整数で返します。
...]{
p sun = Time.new(2017, 9, 17, 10, 34, 15, '+09:00') # => 2017-09-17 10:34:15 +0900
p sun.wday # => 0
p mon = Time.new(2017, 9, 18, 10, 34, 15, '+09:00') # => 2017-09-18 10:34:15 +0900
p mon.wday # => 1
p tue = Time.......5 +0900
p tue.wday # => 2
p wed = Time.new(2017, 9, 20, 10, 34, 15, '+09:00') # => 2017-09-20 10:34:15 +0900
p wed.wday # => 3
p thu = Time.new(2017, 9, 21, 10, 34, 15, '+09:00') # => 2017-09-21 10:34:15 +0900
p thu.wd......# => 4
p fri = Time.new(2017, 9, 22, 10, 34, 15, '+09:00') # => 2017-09-22 10:34:15 +0900
p fri.wday # => 5
p sat = Time.new(2017, 9, 23, 10, 34, 15, '+09:00') # => 2017-09-23 10:34:15 +0900
p sat.wday...