種類
- インスタンスメソッド (253)
- 特異メソッド (126)
- モジュール関数 (24)
- クラス (12)
クラス
-
ARGF
. class (12) - IO (12)
- Range (5)
- Time (350)
キーワード
- % (2)
- Time (12)
- at (53)
- ceil (6)
-
clock
_ gettime (12) -
deconstruct
_ keys (2) - floor (6)
- getgm (12)
- getlocal (24)
- getutc (12)
- gm (24)
- gmt? (12)
-
gmt
_ offset (12) - gmtime (12)
- gmtoff (12)
- inspect (6)
- localtime (24)
- new (19)
- now (6)
- putc (36)
- round (12)
- sec (12)
- step (3)
- strftime (12)
-
to
_ s (12) - utc? (12)
-
utc
_ offset (12)
検索結果
先頭5件
-
Time
# inspect -> String (26.0) -
時刻を文字列に変換した結果を返します。
..."%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
# to _ s -> String (26.0) -
時刻を文字列に変換した結果を返します。 以下のようにフォーマット文字列を使って strftime を呼び出すのと同じです。
...0900"
p t.strftime("%Y-%m-%d %H:%M:%S %z") # => "2000-01-02 03:04:05 +0900"
p t.utc.to_s # => "2000-01-01 18:04:05 UTC"
p t.strftime("%Y-%m-%d %H:%M:%S UTC") # => "2000-01-01 18:04:05 UTC"
//}
戻り値の文字エンコーディングは Encoding::US_ASCII です。... -
Time
. new(iso8601 , in: nil) -> Time (22.0) -
引数で指定した地方時の Time オブジェクトを返します。
...れたISO-8601形式などの文字列を指定します。
@param in 協定世界時との時差を、秒を単位とする整数か、
"UTC" かミリタリータイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。
iso8601......の場合に発生します。
//emlist[][ruby]{
p Time.new("2024-02-15 10:20:30") # => 2024-02-15 10:20:30 +0900
p Time.new("2024-02-15 10:20:30 UTC", in: "+0800") # => 2024-02-15 10:20:30 UTC
p Time.new("2024-02-15 10:20:30", in: "+0800") # => 2024-02-15 10:20:30 +0800
//}... -
Time
# gmt _ offset -> Integer (21.0) -
協定世界時との時差を秒を単位とする数値として返します。
...合][ruby]{
p Time.now.zone # => "JST"
p Time.now.utc_offset # => 32400
//}
タイムゾーンが協定世界時に設定されている場合は 0 を返します。
//emlist[協定世界時の場合][ruby]{
p Time.now.getgm.zone # => "UTC"
p Time.now.getgm.utc_offset # => 0
//}... -
Time
# gmtoff -> Integer (21.0) -
協定世界時との時差を秒を単位とする数値として返します。
...合][ruby]{
p Time.now.zone # => "JST"
p Time.now.utc_offset # => 32400
//}
タイムゾーンが協定世界時に設定されている場合は 0 を返します。
//emlist[協定世界時の場合][ruby]{
p Time.now.getgm.zone # => "UTC"
p Time.now.getgm.utc_offset # => 0
//}... -
Time
# ceil(ndigits=0) -> Time (20.0) -
十進小数点数で指定した桁数の精度で切り上げをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で切り上げます)。
...す)。
ndigits には 0 以上の整数を渡します。
@param ndigits 十進での精度(桁数)
//emlist[][ruby]{
require 'time'
t = Time.utc(2010,3,30, 5,43,25.0123456789r)
t.iso8601(10) # => "2010-03-30T05:43:25.0123456789Z"
t.ceil.iso8601(10) # => "2010-03-30T05:43:26.000000......t = Time.utc(1999,12,31, 23,59,59)
(t + 0.4).ceil.iso8601(3) # => "2000-01-01T00:00:00.000Z"
(t + 0.9).ceil.iso8601(3) # => "2000-01-01T00:00:00.000Z"
(t + 1.4).ceil.iso8601(3) # => "2000-01-01T00:00:01.000Z"
(t + 1.9).ceil.iso8601(3) # => "2000-01-01T00:00:01.000Z"
t = Time.utc(1999,12... -
Time
# floor(ndigits=0) -> Time (20.0) -
十進小数点数で指定した桁数の精度で切り捨てをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で切り捨てます)。
...す)。
ndigits には 0 以上の整数を渡します。
@param ndigits 十進での精度(桁数)
//emlist[][ruby]{
require 'time'
t = Time.utc(2010,3,30, 5,43,25.123456789r)
t.iso8601(10) # => "2010-03-30T05:43:25.1234567890Z"
t.floor.iso8601(10) # => "2010-03-30T05:43:25.00000......= Time.utc(1999,12,31, 23,59,59)
(t + 0.4).floor.iso8601(3) # => "1999-12-31T23:59:59.000Z"
(t + 0.9).floor.iso8601(3) # => "1999-12-31T23:59:59.000Z"
(t + 1.4).floor.iso8601(3) # => "2000-01-01T00:00:00.000Z"
(t + 1.9).floor.iso8601(3) # => "2000-01-01T00:00:00.000Z"
t = Time.utc(1999,... -
Time
. new(year , mon = nil , day = nil , hour = nil , min = nil , sec = nil , in: nil) -> Time (17.0) -
引数で指定した地方時の Time オブジェクトを返します。
...位とする整数か、
"UTC" かミリタリータイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。
@param in 協定世界時との時差を、秒を単位とする整数か、
"UTC" かミリタリータイムゾーン... -
Time
. new(year , mon = nil , day = nil , hour = nil , min = nil , sec = nil , zone = nil) -> Time (17.0) -
引数で指定した地方時の Time オブジェクトを返します。
...位とする整数か、
"UTC" かミリタリータイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。
@param in 協定世界時との時差を、秒を単位とする整数か、
"UTC" かミリタリータイムゾーン... -
Time (14.0)
-
時刻を表すクラスです。
...ブジェクトです。
Time オブジェクトは時刻を起算時からの経過秒数で保持しています。
起算時は協定世界時(UTC、もしくはその旧称から GMT とも表記されます) の
1970年1月1日午前0時です。なお、うるう秒を勘定するかどうか......イムゾーンのフラグは Marshal データに保持されます。
//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 以降の Ti... -
Time
# round(ndigits=0) -> Time (14.0) -
十進小数点数で指定した桁数の精度で丸めをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で丸めます)。
...す)。
ndigits には 0 以上の整数を渡します。
@param ndigits 十進での精度(桁数)
//emlist[][ruby]{
require 'time'
t = Time.utc(1999,12,31, 23,59,59)
p((t + 0.4).round.iso8601(3)) # => "1999-12-31T23:59:59.000Z"
p((t + 0.49).round.iso8601(3)) # => "1999-12-31T23:59:59.000......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"
//}......000-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"
//}
@see Time#ceil, Time#floor... -
Time
. new(year , mon = nil , day = nil , hour = nil , min = nil , sec = nil , in: nil) -> Time (14.0) -
引数で指定した地方時の Time オブジェクトを返します。
...位とする整数か、
"UTC" かミリタリータイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。
@param in 協定世界時との時差を、秒を単位とする整数か、
"UTC" かミリタリータイムゾーン... -
Time
. new(year , mon = nil , day = nil , hour = nil , min = nil , sec = nil , zone = nil) -> Time (14.0) -
引数で指定した地方時の Time オブジェクトを返します。
...位とする整数か、
"UTC" かミリタリータイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。
@param in 協定世界時との時差を、秒を単位とする整数か、
"UTC" かミリタリータイムゾーン... -
Time
. at(seconds , xseconds , unit) -> Time (13.0) -
unit に応じて seconds + xseconds ミリ秒などの時刻を表す Time オブジェクトを返します。
..., :microsecond, :nsec, :nanosecond のいずれかを指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
"UTC" かミリタリータイムゾーンの文字列または
数値でタイムゾーンを指定します。
//emlist[][ruby]{
Time.at(94... -
Time
. at(seconds , xseconds , unit , in:) -> Time (13.0) -
unit に応じて seconds + xseconds ミリ秒などの時刻を表す Time オブジェクトを返します。
..., :microsecond, :nsec, :nanosecond のいずれかを指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
"UTC" かミリタリータイムゾーンの文字列または
数値でタイムゾーンを指定します。
//emlist[][ruby]{
Time.at(94... -
Time
. at(time , usec) -> Time (13.0) -
time + (usec/1000000) の時刻を表す Time オブジェクトを返します。 浮動小数点の精度では不十分な場合に使用します。
...ger、 Float、 Rational、または他のNumericで指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
"UTC" かミリタリータイムゾーンの文字列または
数値でタイムゾーンを指定します。
//emlist[][ruby]{
Time.at(94...