るりまサーチ

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

別のキーワード

  1. net/http get
  2. http get
  3. http start
  4. net/http start
  5. net/http post

クラス

検索結果

Time.httpdate(date) -> Time (6124.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#httpdate -> String (6118.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...
...-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.httpdate #=> "Sun, 31 Aug 2008 03:34:56 GMT"...