るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

Time#sec -> Integer (3126.0)

秒を整数で返します。

...秒を整数で返します。

//emlist[][ruby]{
p Time.mktime(2000, 1, 1).sec # => 0
//}

通常は0から59を返しますが、うるう秒の場合は60を返します。

//emlist[][ruby]{
ENV['TZ'] = 'right/UTC'
p Time.mktime(2005, 12, 31, 23, 59, 60).sec # => 60
//}...

Time#utc_offset -> Integer (3126.0)

協定世界時との時差を秒を単位とする数値として返します。

...//emlist[地方時の場合][ruby]{
p Time.now.zone # => "JST"
p Time.now.utc_offset # => 32400
//}

タイムゾーンが協定世界時に設定されている場合は 0 を返します。

//emlist[協定世界時の場合][ruby]{
p Time.now.getgm.zone # => "UTC"
p Time.now.getg...

Time#tv_sec -> Integer (3121.0)

起算時からの経過秒数を整数で返します。

...起算時からの経過秒数を整数で返します。

//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5,6)
p t # => 2000-01-02 03:04:05 +0900
p "%10.6f" % t.to_f # => "946749845.000006"
p t.to_i # => 946749845
p t.tv_sec # => 946749845
//}...

Time#-(sec) -> Time (3116.0)

自身より sec 秒だけ前の時刻を返します。

...自身より sec 秒だけ前の時刻を返します。

@param sec 実数を秒を単位として指定します。

//emlist[][ruby]{
p t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p t2 = t + 2592000 # => 2000-01-31 00:00:00 +0900
p t2 - 2592000 # => 2000-01-01 00:00:00 +09...

Time#-(time) -> Float (3116.0)

自身と time との時刻の差を Float で返します。単位は秒です。

...自身と time との時刻の差を Float で返します。単位は秒です。

@param time 自身との差を算出したい Time オブジェクトを指定します。

//emlist[][ruby]{
p t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p t2 = t + 2592000 # => 2000-01-31 00:00:00 +...

絞り込み条件を変える

Time#+(other) -> Time (3114.0)

self より other 秒だけ後の時刻を返します。

...self より other 秒だけ後の時刻を返します。

@param other 自身からの秒数を数値で指定します。

//emlist[][ruby]{
p t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p t + (60 * 60 * 24) # => 2000-01-02 00:00:00 +0900
//}...

Time#day -> Integer (3114.0)

日を整数で返します。

...日を整数で返します。

//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5) # => 2000-01-02 03:04:05 +0900
p t.day # => 2
p t.mday # => 2
//}...

Time#deconstruct_keys(array_of_names_or_nil) -> Hash (3114.0)

パターンマッチに使用する名前と値の Hash を返します。

...our
* :min
* :sec
* :subsec
* :dst
* :zone

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
t = Time.utc(2022, 10, 5, 21, 25, 30)

i
f t in wday: 3,...
...使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される

case t
i
n year: ...2022
puts "too old"
i
n month: ..9
puts "quarter 1-3"
i
n wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day in month 10" が出力され...
...

# クラスのチェックと組み合わせて利用することもできます
i
f t in Time(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Time#floor(ndigits=0) -> Time (3114.0)

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

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

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

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

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

t = Time.utc(2010,3,30, 5,43,25.123456789r)
t.iso86...
....1234567890Z"
t.floor.iso8601(10) # => "2010-03-30T05:43:25.0000000000Z"
t.floor(0).iso8601(10) # => "2010-03-30T05:43:25.0000000000Z"
t.floor(1).iso8601(10) # => "2010-03-30T05:43:25.1000000000Z"
t.floor(2).iso8601(10) # => "2010-03-30T05:43:25.1200000000Z"
t.floor(3).iso8601(10) # => "2010...
...r(4).iso8601(10) # => "2010-03-30T05:43:25.1234000000Z"

t = 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.iso86...

Time#getgm -> Time (3114.0)

タイムゾーンを協定世界時に設定した Time オブジェクトを新しく 生成して返します。

...タイムゾーンを協定世界時に設定した Time オブジェクトを新しく
生成して返します。

//emlist[][ruby]{
p t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 +0900
p t.gmt? #=> false
p y = t.getgm #=> 2000-01-0...

絞り込み条件を変える

Time#getlocal -> Time (3114.0)

タイムゾーンを地方時に設定した Time オブジェクトを新しく生成 して返します。

...タイムゾーンを地方時に設定した Time オブジェクトを新しく生成
して返します。

@param utc_offset タイムゾーンを地方時に設定する代わりに協定世界時との
時差を、秒を単位とする整数か、"+HH:MM" "-HH:MM" 形式...
...の文字列で指定します。

//emlist[][ruby]{
p t = Time.utc(2000,1,1,20,15,1) # => 2000-01-01 20:15:01 UTC
p t.utc? # => true
p l = t.getlocal # => 2000-01-02 05:15:01 +0900
p l.utc? # => false
p t == l...
<< < 1 2 3 4 5 ... > >>