るりまサーチ

最速Rubyリファレンスマニュアル検索!
98件ヒット [1-98件を表示] (0.037秒)
トップページ > クエリ:time[x] > クエリ:httpdate[x]

別のキーワード

  1. time rfc2822
  2. time iso8601
  3. time strptime
  4. time parse

ライブラリ

クラス

キーワード

検索結果

Time.httpdate(date) -> Time (35290.0)

2616で定義されているHTTP-dateとしてdateをパースして Timeオブジェクトに変換します。

...2616で定義されているHTTP-dateとしてdateをパースして
Time
オブジェクトに変換します。

dateが2616に準拠していない、または
Time
クラスが指定された日時を表現できないときにArgumentErrorが
発生します。

@param date 2616で定義され...
... 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
.httpdate(n...
...on_rfc2616_time)
rescue ArgumentError => err
puts err #=> not RFC 2616 compliant date: "San, 31 Aug 2008 12:34:56 GMT"
end...

Time#httpdate -> String (35131.0)

2616 で定義されている HTTP-date の rfc1123-date 形式の文字列を 返します。

...を返します。
//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"...

DateTime.httpdate(str = 'Mon, 01 Jan -4712 00:00:00 GMT', start = Date::ITALY) -> DateTime (21207.0)

2616 で定められた書式の日付を解析し、 その情報に基づいて日付オブジェクトを生成します。

...2616 で定められた書式の日付を解析し、
その情報に基づいて日付オブジェクトを生成します。

Date._httpdate も参照してください。

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

Time.parse(date, now = Time.now) -> Time (17360.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 オブジェクトに変換可能な文字列...
...ドのフェイルセーフとして
以下のように使用できます:

require 'time'

Time
.rfc2822(date) rescue Time.parse(date)
Time
.httpdate(date) rescue Time.parse(date)
Time
.xmlschema(date) rescue Time.parse(date)

従って Time.parse の失敗はチェックすべきです。...

Time.parse(date, now = Time.now) {|year| year } -> Time (17360.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 オブジェクトに変換可能な文字列...
...ドのフェイルセーフとして
以下のように使用できます:

require 'time'

Time
.rfc2822(date) rescue Time.parse(date)
Time
.httpdate(date) rescue Time.parse(date)
Time
.xmlschema(date) rescue Time.parse(date)

従って Time.parse の失敗はチェックすべきです。...

絞り込み条件を変える

Time (6078.0)

時刻を表すクラスです。

...時刻を表すクラスです。

Time
.now は現在の時刻を返します。
File.mtime などが返すファイルのタイムスタンプは Time
オブジェクトです。

Time
オブジェクトは時刻を起算時からの経過秒数で保持しています。
起算時は協定世界...
...定するかどうかはシステムに
よります。

Time
オブジェクトが格納可能な時刻の範囲は環境によって異なっていましたが、
Ruby 1.9.2 からは OS の制限の影響を受けません。

また、Time オブジェクトは協定世界時と地方時のど...
...ます。

//emlist[][ruby]{
p Marshal.load(Marshal.dump(Time.now.gmtime)).zone
# => "UTC"
//}

time
ライブラリによって、Time.parse, Time.rfc2822, Time.httpdate, Time.iso8601 等が拡張されます。

Ruby 1.9.2 以降の Time クラスのデザインの詳細は
https://staff.aist.go.j...

NEWS for Ruby 2.2.0 (60.0)

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

...* Float
* 追加: Float#next_float
* 追加: Float#prev_float

* File
* 追加: File.birthtime
* 追加: File#birthtime

* File::Stat
* 追加: File::Stat#birthtime

* GC
* GC.latest_gc_info は現在のGCのステータスを再現するために :state を返す...
...追加: Vector.independent?, Vector#independent?

* pathname
* Pathname#/ は Pathname#+ のエイリアスです
* 追加: Pathname#birthtime

* rake
* Rake 10.4.0 になりました。
http://docs.seattlerb.org/rake/History_rdoc.html#label-10.4.0

* rubygems
* RubyGems...
...* time
* Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema may produce
fixed-offset Time objects.
It is happen when usual localtime doesn't preserve the offset from UTC.
* Time.httpdate は常にUTCのTimeオブジェクトを生成します。
* Time.strptime...

UnboundMethod#source_location -> [String, Integer] | nil (30.0)

ソースコードのファイル名と行番号を配列で返します。

...合は nil を返します。

//emlist[例][ruby]{
require 'time'

Time
.instance_method(:zone).source_location # => nil
Time
.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_locati...

WEBrick::HTTPResponse#[]=(field, val) (18.0)

レスポンスの該当するヘッダに val を設定します。

...せん。

@param val ヘッダの値を指定します。to_s メソッドによって文字列に変換されます。

require 'time'
res['last-modified'] = Time.now.httpdate

@see WEBrick::HTTPResponse#chunked?, WEBrick::HTTPResponse#content_length,
WEBrick::HTTPResponse#content_type...