るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Time#to_datetime -> DateTime (41400.0)

対応する DateTime オブジェクトを返します。

...対応する DateTime オブジェクトを返します。...

Time#to_date -> Date (35218.0)

対応する Date オブジェクトを返します。

...対応する Date オブジェクトを返します。...

Time#to_time -> Time (35218.0)

対応する Time オブジェクトを返します。

...対応する Time オブジェクトを返します。...

Date#to_datetime -> DateTime (29400.0)

対応する DateTime オブジェクトを返します。

...対応する DateTime オブジェクトを返します。...

Time#strftime(format) -> String (27442.0)

時刻を format 文字列に従って文字列に変換した結果を返します。

...または午後(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 と同等...
...含むUTCからのオフセット (例 +09:00:00)
* %%: %自身
* %+: date(1)の形式 (%a %b %e %H:%M:%S %Z %Y) (Time#strftime は対応していませんが、Date#strftime で使えます)

このメソッドは strftime(3) や glibcの仕様を参考に作成されており、以下のオプ...
...uby]{
p t = Time.new(2001,2,3,4,5,6,"+09:00") # => 2001-02-03 04:05:06 +0900
p t.strftime("Printed on %m/%d/%Y") # => "Printed on 02/03/2001"
p t.strftime("Printed on %m/%-d/%_6Y") # => "Printed on 02/3/ 2001"
p t.strftime("at %I:%M%p") # => "at 04:05AM"
p t.strftime("at %I:%M...

絞り込み条件を変える

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

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

...るHTTP-dateとしてdateをパースして
Time
オブジェクトに変換します。

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

@param date 2616で定義されているHTTP-dateとして...
...ntError 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(non_rfc2616_time)
rescue ArgumentError => err
puts err #=> not RFC 2616 compliant date: "San, 31 Aug 2008 12:34:56 GMT"
end...

Time.strptime(date, format, now=self.now) -> Time (27378.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 'time'...
...Time.strptime('91/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
}
#=> 1991-05-18 04:13:00 +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 format 書式文字列...

Time.strptime(date, format, now=self.now) {|y| ... } -> Time (27378.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 'time'...
...Time.strptime('91/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
}
#=> 1991-05-18 04:13:00 +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 format 書式文字列...

Time#httpdate -> String (27156.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"...

Date.strptime(str = &#39;-4712-01-01&#39;, format = &#39;%F&#39;, start = Date::ITALY) -> Date (23320.0)

与えられた雛型で日付表現を解析し、 その情報に基づいて日付オブジェクトを生成します。

...す。

Date
._strptime も参照してください。
また strptime(3)、および Date#strftime も参照してください。

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

絞り込み条件を変える

<< 1 2 3 ... > >>