るりまサーチ (Ruby 2.4.0)

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

別のキーワード

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

キーワード

検索結果

Time#strftime(format) -> String (45853.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 と同等...
...セット (例 +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#round(ndigits=0) -> Time (27544.0)

十進小数点数で指定した桁数の精度で丸めをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で丸めます)。

...で丸めをし、
その Time オブジェクトを返します。
(デフォルトは0、つまり小数点の所で丸めます)。

ndigits には 0 以上の整数を渡します。

@param ndigits 十進での精度(桁数)

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

t = Time.utc(1999,12,31, 23,59,59)...
...ound.iso8601(3)) # => "2000-01-01T00:00:00.000Z"
p((t + 1.49).round.iso8601(3)) # => "2000-01-01T00:00:00.000Z"
p((t + 1.5).round.iso8601(3)) # => "2000-01-01T00:00:01.000Z"

t = Time.utc(1999,12,31, 23,59,59)
p (t + 0.123456789).round(4).iso8601(6) # => "1999-12-31T23:59:59.123500Z"
//}...