D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Time
/
Filename :
new-c.ri
back
Copy
U:RDoc::AnyMethod[iI"new:ETI"Time::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"?Returns a new +Time+ object based on the given arguments, ;TI"&by default in the local timezone.;To:RDoc::Markup::BlankLine o; ; [I"AWith no positional arguments, returns the value of Time.now:;T@o:RDoc::Markup::Verbatim; [I"5Time.new # => 2021-04-24 17:27:46.0512465 -0500 ;T:@format0o; ; [I"DWith one string argument that represents a time, returns a new ;TI"F+Time+ object based on the given argument, in the local timezone.;T@o;; [ I"UTime.new('2000-12-31 23:59:59.5') # => 2000-12-31 23:59:59.5 -0600 ;TI"UTime.new('2000-12-31 23:59:59.5 +0900') # => 2000-12-31 23:59:59.5 +0900 ;TI"UTime.new('2000-12-31 23:59:59.5', in: '+0900') # => 2000-12-31 23:59:59.5 +0900 ;TI"UTime.new('2000-12-31 23:59:59.5') # => 2000-12-31 23:59:59.5 -0600 ;TI"\Time.new('2000-12-31 23:59:59.56789', precision: 3) # => 2000-12-31 23:59:59.567 -0600 ;T; 0o; ; [I"<With one to six arguments, returns a new +Time+ object ;TI"9based on the given arguments, in the local timezone.;T@o;; [I"BTime.new(2000, 1, 2, 3, 4, 5) # => 2000-01-02 03:04:05 -0600 ;T; 0o; ; [I"6For the positional arguments (other than +zone+):;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"(+year+: Year, with no range limits:;T@o;; [I">Time.new(999999999) # => 999999999-01-01 00:00:00 -0600 ;TI"?Time.new(-999999999) # => -999999999-01-01 00:00:00 -0600 ;T; 0o;;0; [o; ; [I":+month+: Month in range (1..12), or case-insensitive ;TI"3-letter month name:;T@o;; [ I":Time.new(2000, 1) # => 2000-01-01 00:00:00 -0600 ;TI":Time.new(2000, 12) # => 2000-12-01 00:00:00 -0600 ;TI":Time.new(2000, 'jan') # => 2000-01-01 00:00:00 -0600 ;TI":Time.new(2000, 'JAN') # => 2000-01-01 00:00:00 -0600 ;T; 0o;;0; [o; ; [I"'+mday+: Month day in range(1..31):;T@o;; [I":Time.new(2000, 1, 1) # => 2000-01-01 00:00:00 -0600 ;TI":Time.new(2000, 1, 31) # => 2000-01-31 00:00:00 -0600 ;T; 0o;;0; [o; ; [I"F+hour+: Hour in range (0..23), or 24 if +min+, +sec+, and +usec+ ;TI"are zero:;T@o;; [I"=Time.new(2000, 1, 1, 0) # => 2000-01-01 00:00:00 -0600 ;TI"=Time.new(2000, 1, 1, 23) # => 2000-01-01 23:00:00 -0600 ;TI"=Time.new(2000, 1, 1, 24) # => 2000-01-02 00:00:00 -0600 ;T; 0o;;0; [o; ; [I"$+min+: Minute in range (0..59):;T@o;; [I"@Time.new(2000, 1, 1, 0, 0) # => 2000-01-01 00:00:00 -0600 ;TI"@Time.new(2000, 1, 1, 0, 59) # => 2000-01-01 00:59:00 -0600 ;T; 0o;;0; [o; ; [I"%+sec+: Second in range (0...61):;T@o;; [I"CTime.new(2000, 1, 1, 0, 0, 0) # => 2000-01-01 00:00:00 -0600 ;TI"CTime.new(2000, 1, 1, 0, 0, 59) # => 2000-01-01 00:00:59 -0600 ;TI"CTime.new(2000, 1, 1, 0, 0, 60) # => 2000-01-01 00:01:00 -0600 ;T; 0o; ; [I"$+sec+ may be Float or Rational.;T@o;; [I"HTime.new(2000, 1, 1, 0, 0, 59.5) # => 2000-12-31 23:59:59.5 +0900 ;TI"HTime.new(2000, 1, 1, 0, 0, 59.7r) # => 2000-12-31 23:59:59.7 +0900 ;T; 0o; ; [I"These values may be:;T@o;;;;[o;;0; [o; ; [I"Integers, as above.;To;;0; [o; ; [I"&Numerics convertible to integers:;T@o;; [I">Time.new(Float(0.0), Rational(1, 1), 1.0, 0.0, 0.0, 0.0) ;TI"$# => 0000-01-01 00:00:00 -0600 ;T; 0o;;0; [o; ; [I"String integers:;T@o;; [I"a = %w[0 1 1 0 0 0] ;TI")# => ["0", "1", "1", "0", "0", "0"] ;TI"1Time.new(*a) # => 0000-01-01 00:00:00 -0600 ;T; 0o; ; [ I"IWhen positional argument +zone+ or keyword argument +in:+ is given, ;TI"9the new +Time+ object is in the specified timezone. ;TI"+For the forms of argument +zone+, see ;TI">{Timezone Specifiers}[rdoc-ref:Time@Timezone+Specifiers]:;T@o;; [I"-Time.new(2000, 1, 1, 0, 0, 0, '+12:00') ;TI"$# => 2000-01-01 00:00:00 +1200 ;TI"1Time.new(2000, 1, 1, 0, 0, 0, in: '-12:00') ;TI"$# => 2000-01-01 00:00:00 -1200 ;TI"Time.new(in: '-12:00') ;TI",# => 2022-08-23 08:49:26.1941467 -1200 ;T; 0o; ; [I"GSince +in:+ keyword argument just provides the default, so if the ;TI"Jfirst argument in single string form contains time zone information, ;TI"4this keyword argument will be silently ignored.;T@o;; [I"NTime.new('2000-01-01 00:00:00 +0100', in: '-0500').utc_offset # => 3600 ;T; 0o;;;;[o;;0; [o; ; [I"M+precision+: maximum effective digits in sub-second part, default is 9. ;TI"CMore digits will be truncated, as other operations of +Time+. ;TI"3Ignored unless the first argument is a string.;T: @fileI" timev.rb;T:0@omit_headings_from_table_of_contents_below0I"vTime.new(year = nil, mon = nil, mday = nil, hour = nil, min = nil, sec = nil, zone = nil, in: nil, precision: 9) ;T0[ I"(year = (now = true), mon = (str = year; nil), mday = nil, hour = nil, min = nil, sec = nil, zone = nil, in: nil, precision: 9);T@�FI" Time;TcRDoc::NormalClass00