localtime

time.localtime â time
time.localtime(utc_offset) â time
Instance Public methods

Converts time to local time (using the local time zone in effect for this process) modifying the receiver.

If utc_offset is given, it is used instead of the local time.

1
2
3
4
5
6
7
8
t = Time.utc(2000, "jan", 1, 20, 15, 1) #=> 2000-01-01 20:15:01 UTC
t.utc?                                  #=> true
 
t.localtime                             #=> 2000-01-01 14:15:01 -0600
t.utc?                                  #=> false
 
t.localtime("+09:00")                   #=> 2000-01-02 05:15:01 +0900
t.utc?                                  #=> false
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.