るりまサーチ

最速Rubyリファレンスマニュアル検索!
237件ヒット [1-100件を表示] (0.043秒)
トップページ > クエリ:Ruby[x] > クエリ:on[x] > クラス:Time[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

Time.json_create(hash) -> Time (6117.0)

JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

...JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

@param hash 適切なキーを持つハッシュを指定します。...

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

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

...* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone

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

//emlist[例][ruby]{
t = Time.ut...
...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: 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#mon -> Integer (6107.0)

月を整数で返します。

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

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

Time#monday? -> bool (6107.0)

self の表す時刻が月曜日である場合に true を返します。 そうでない場合に false を返します。

...self の表す時刻が月曜日である場合に true を返します。
そうでない場合に false を返します。

//emlist[][ruby]{
t = Time.local(2003, 8, 4) # => 2003-08-04 00:00:00 +0900
p t.monday? # => true
//}...

Time#month -> Integer (6107.0)

月を整数で返します。

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

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

絞り込み条件を変える

Time#to_json(*args) -> String (6107.0)

自身を JSON 形式の文字列に変換して返します。

...身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡され...
...ます。

//emlist[例][ruby]{
require "json/add/core"

Time
.now.to_json # => "{\"json_class\":\"Time\",\"s\":1544968675,\"n\":676167000}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

Time#zone -> String (6107.0)

タイムゾーンを表す文字列を返します。

...タイムゾーンを表す文字列を返します。

//emlist[][ruby]{
p Time.now.zone # => "JST"
//}...

Time.at(seconds, xseconds, unit) -> Time (209.0)

unit に応じて seconds + xseconds ミリ秒などの時刻を表す Time オブジェクトを返します。

...unit に応じて seconds + xseconds ミリ秒などの時刻を表す Time オブジェクトを返します。

@param seconds 起算時からの経過秒数を表わす値をInteger、 Float、 Rational、または他のNumericで指定します。
@param xseconds unit に対応するミリ秒...
...nit :millisecond, :usec, :microsecond, :nsec, :nanosecond のいずれかを指定します。

//emlist[][ruby]{
Time
.at(946684800, 123.456789, :millisecond).nsec # => 123456789
Time
.at(946684800, 123456.789, :usec).nsec # => 123456789
Time
.at(946684800, 123456.789, :microsecond).nsec # =...
...econd, :usec, :microsecond, :nsec, :nanosecond のいずれかを指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
数値でタイムゾーンを指定します。

//emlist[][ruby]{
Time
.at(946684800, 123.456789, :millisecond).nsec # => 123456789
Time
.a...
...t(946684800, 123456.789, :usec).nsec # => 123456789
Time
.at(946684800, 123456.789, :microsecond).nsec # => 123456789
Time
.at(946684800, 123456789, :nsec).nsec # => 123456789
//}...
...econd, :usec, :microsecond, :nsec, :nanosecond のいずれかを指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
"UTC" かミリタリータイムゾーンの文字列または
数値でタイムゾーンを指定します。

//emlist[][ruby]...
...{
Time.at(946684800, 123.456789, :millisecond).nsec # => 123456789
Time
.at(946684800, 123456.789, :usec).nsec # => 123456789
Time
.at(946684800, 123456.789, :microsecond).nsec # => 123456789
Time
.at(946684800, 123456789, :nsec).nsec # => 123456789
//}...

Time.at(seconds, xseconds, unit, in:) -> Time (209.0)

unit に応じて seconds + xseconds ミリ秒などの時刻を表す Time オブジェクトを返します。

...unit に応じて seconds + xseconds ミリ秒などの時刻を表す Time オブジェクトを返します。

@param seconds 起算時からの経過秒数を表わす値をInteger、 Float、 Rational、または他のNumericで指定します。
@param xseconds unit に対応するミリ秒...
...econd, :usec, :microsecond, :nsec, :nanosecond のいずれかを指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
数値でタイムゾーンを指定します。

//emlist[][ruby]{
Time
.at(946684800, 123.456789, :millisecond).nsec # => 123456789
Time
.a...
...t(946684800, 123456.789, :usec).nsec # => 123456789
Time
.at(946684800, 123456.789, :microsecond).nsec # => 123456789
Time
.at(946684800, 123456789, :nsec).nsec # => 123456789
//}...
...econd, :usec, :microsecond, :nsec, :nanosecond のいずれかを指定します。
@param in "+HH:MM" や "-HH:MM" のような形式の文字列か
"UTC" かミリタリータイムゾーンの文字列または
数値でタイムゾーンを指定します。

//emlist[][ruby]...
...{
Time.at(946684800, 123.456789, :millisecond).nsec # => 123456789
Time
.at(946684800, 123456.789, :usec).nsec # => 123456789
Time
.at(946684800, 123456.789, :microsecond).nsec # => 123456789
Time
.at(946684800, 123456789, :nsec).nsec # => 123456789
//}...

Time.new(year, mon = nil, day = nil, hour = nil, min = nil, sec = nil, zone = nil) -> Time (209.0)

引数で指定した地方時の Time オブジェクトを返します。

...引数で指定した地方時の Time オブジェクトを返します。

mon day hour min sec に nil を指定した場合の値は、その引数がとり得る最小の値です。
zone に nil を指定した場合の値は、現在のタイムゾーンに従います。

@param year 年を...
...整数か文字列で指定します。例えば 1998 年に対して 1998 を指定します。

@param mon 1(1月)から 12(12月)の範囲の整数または文字列で指定します。
英語の月名("Jan", "Feb", ... などの省略名。大文字小文字の違いは無視しま...
...うるう秒)

@param zone 協定世界時との時差を、秒を単位とする整数か、
"+HH:MM" "-HH:MM" 形式の文字列で指定します。

@raise ArgumentError 与えられた引数が無効である場合に発生します。

//emlist[][ruby]{
p Time.new(2008, 6, 21, 13,...
...タイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。

@raise ArgumentError 与えられた引数が無効である場合に発生します。

//emlist[][ruby]{
p Time.new(2008, 6, 21, 13, 30, 0, "+09:00") # => 2008-06-21 13:30:00 +0900
//}...
...引数で指定した地方時の Time オブジェクトを返します。

mon day hour min sec に nil を指定した場合の値は、その引数がとり得る最小の値です。
zone と in に nil を指定した場合の値は、現在のタイムゾーンに従います。

@param year...
...年を整数か文字列で指定します。例えば 1998 年に対して 1998 を指定します。

@param mon 1(1月)から 12(12月)の範囲の整数または文字列で指定します。
英語の月名("Jan", "Feb", ... などの省略名。大文字小文字の違いは無視...
...列で指定します。

@raise ArgumentError 与えられた引数が無効である場合に発生します。
@raise ArgumentError zone と in を同時に指定した場合に発生します。

//emlist[][ruby]{
p Time.new(2008, 6, 21, 13, 30, 0, "+09:00") # => 2008-06-21 13:30:00 +0900
//}...

絞り込み条件を変える

<< 1 2 3 > >>