224件ヒット
[201-224件を表示]
(0.080秒)
別のキーワード
ライブラリ
- ビルトイン (224)
検索結果
-
Time
# getgm -> Time (144.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-01 11:15:01 UTC
p y.gmt?... -
Time
# sec -> Integer (132.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
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (126.0) -
パターンマッチに使用する名前と値の Hash を返します。
...list[例][ruby]{
t = Time.utc(2022, 10, 5, 21, 25, 30)
if t in wday: 3, day: ..7 # deconstruct_keys が使われます
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......ng 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...