るりまサーチ

最速Rubyリファレンスマニュアル検索!
112件ヒット [1-100件を表示] (0.138秒)

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. kernel $-i

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Time#zone -> String (21208.0)

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

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

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

DateTime#zone -> String (21202.0)

タイムゾーンを返します。

タイムゾーンを返します。

これは、正確には時差をあらわす文字列です。

UnboundMethod#source_location -> [String, Integer] | nil (6107.0)

ソースコードのファイル名と行番号を配列で返します。

...nil を返します。

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

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_location...

Time#rfc2822 -> String (3119.0)

2822 で定義されている date-time として表現される形式の文字列を 返します。

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

@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss zone
//}
ただし zone は [+-]hhmm です。
self が UTC time の場合、zone は +0000 に...
...なります。

使用例
require 'time'

i
so8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.rfc2822 #=> "Sun, 31 Aug 2008 03:34:56 -0000"...

Time#rfc822 -> String (3119.0)

2822 で定義されている date-time として表現される形式の文字列を 返します。

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

@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss zone
//}
ただし zone は [+-]hhmm です。
self が UTC time の場合、zone は +0000 に...
...なります。

使用例
require 'time'

i
so8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.rfc2822 #=> "Sun, 31 Aug 2008 03:34:56 -0000"...

絞り込み条件を変える

Time#gmt_offset -> Integer (3113.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#gmtoff -> Integer (3113.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#utc_offset -> Integer (3113.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...

DateTime#deconstruct_keys(array_of_names_or_nil) -> Hash (3107.0)

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

...hour
* :min
* :sec
* :sec_fraction
* :zone

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

//emlist[例][ruby]{
dt = DateTime.new(2022, 10, 5, 13, 30)

i
f dt in wday: 1....
...nstruct_keys が使われます
puts "Working time"
end
#=> "Working time" が出力される

case dt
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 dt in DateTime(wday: 1..5, hour: 10..18, day: ..7)
puts "Working time, first week of the month"
end
//}

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

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

絞り込み条件を変える

<< 1 2 > >>