675件ヒット
[201-300件を表示]
(0.097秒)
別のキーワード
ライブラリ
- ビルトイン (663)
-
json
/ add / time (12)
キーワード
- + (12)
- - (24)
- <=> (12)
- asctime (12)
- ceil (6)
- ctime (12)
- day (12)
-
deconstruct
_ keys (2) - dst? (12)
- eql? (12)
- floor (6)
- friday? (12)
- getgm (12)
- getlocal (24)
- getutc (12)
- gmt? (12)
-
gmt
_ offset (12) - gmtime (12)
- gmtoff (12)
- hour (12)
- inspect (6)
- isdst (12)
- localtime (24)
- mday (12)
- min (12)
- mon (12)
- monday? (12)
- month (12)
- nsec (12)
- round (12)
- saturday? (12)
- sec (12)
- strftime (12)
- subsec (12)
- succ (7)
- sunday? (12)
- thursday? (12)
-
to
_ a (12) -
to
_ f (12) -
to
_ i (12) -
to
_ json (12) -
to
_ r (12) -
to
_ s (12) - tuesday? (12)
-
tv
_ nsec (12) -
tv
_ sec (12) -
tv
_ usec (12) - usec (12)
- utc (12)
- utc? (12)
-
utc
_ offset (12) - wday (12)
- wednesday? (12)
- yday (12)
- year (12)
- zone (12)
検索結果
先頭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)
if t in wday: 3,......使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される
case t
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day in month 10" が出力され......る
# クラスのチェックと組み合わせて利用することもできます
if 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...