るりまサーチ

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

別のキーワード

  1. optparse on
  2. optionparser on
  3. tracer on
  4. thread abort_on_exception
  5. thread abort_on_exception=

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

Time#deconstruct_keys(array_of_names_or_nil) -> Hash (6101.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 (6101.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 (6101.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 (6101.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 (6101.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 (6101.0)

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

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

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

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

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

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

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

Time#iso8601(fractional_seconds = 0) -> String (201.0)

XML Schema で定義されている dateTime として 表現される形式の文字列を返します。

...いる dateTime として
表現される形式の文字列を返します。

XML Schema で定義されている dateTime として
表現される形式の文字列をパースするためのクラスメソッド
Time
.iso8601, Time.xmlschema もあります。

@param fractional_seconds 小数点...
...ただし TZD は Z または [+-]hh:mm です。

使用例
require 'time'

iso8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.xmlschema #=> "2008-08-31T03:34:56Z"
p t.xmlschema(9) #=> "2008-08-31T03:34:56.000000000Z"

@see Time.iso8601, Time.xmlschema...

Time#xmlschema(fractional_seconds = 0) -> String (201.0)

XML Schema で定義されている dateTime として 表現される形式の文字列を返します。

...いる dateTime として
表現される形式の文字列を返します。

XML Schema で定義されている dateTime として
表現される形式の文字列をパースするためのクラスメソッド
Time
.iso8601, Time.xmlschema もあります。

@param fractional_seconds 小数点...
...ただし TZD は Z または [+-]hh:mm です。

使用例
require 'time'

iso8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.xmlschema #=> "2008-08-31T03:34:56Z"
p t.xmlschema(9) #=> "2008-08-31T03:34:56.000000000Z"

@see Time.iso8601, Time.xmlschema...

Time.at(seconds, xseconds, unit) -> Time (201.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 # =...
...かマイクロ秒かナノ秒を指定します。
@param unit :millisecond, :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
//}...

絞り込み条件を変える

<< 1 2 3 > >>