mirror of
https://github.com/ruby/ruby.git
synced 2026-08-01 02:20:48 +08:00
[DOC] Fix Time#localtime return value (#17928)
This commit is contained in:
parent
5968753774
commit
f10a97dba9
Notes:
git
2026-07-26 15:13:45 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>
11
time.c
11
time.c
@ -4163,20 +4163,19 @@ time_zonelocal(VALUE time, VALUE off)
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* localtime -> self or new_time
|
||||
* localtime(zone) -> new_time
|
||||
* localtime -> self
|
||||
* localtime(zone) -> self
|
||||
*
|
||||
* With no argument given:
|
||||
*
|
||||
* - Returns +self+ if +self+ is a local time.
|
||||
* - Otherwise returns a new +Time+ in the user's local timezone:
|
||||
* - Returns +self+ if +self+ is already a local time.
|
||||
* - Otherwise returns +self+, converted to the user's local timezone:
|
||||
*
|
||||
* t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
|
||||
* t.localtime # => 2000-01-01 14:15:01 -0600
|
||||
*
|
||||
* With argument +zone+ given,
|
||||
* returns the new +Time+ object created by converting
|
||||
* +self+ to the given time zone:
|
||||
* returns +self+, converted to the given time zone:
|
||||
*
|
||||
* t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
|
||||
* t.localtime("-09:00") # => 2000-01-01 11:15:01 -0900
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user