method
localtime
ruby latest stable - Class:
Time
localtime(p1 = v1)public
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.
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
If utc_offset is not given and time is local time, just return the receiver.
static VALUE
time_localtime_m(int argc, VALUE *argv, VALUE time)
{
VALUE off;
rb_scan_args(argc, argv, "01", &off);
if (!NIL_P(off)) {
off = utc_offset_arg(off);
validate_utc_offset(off);
time_set_utc_offset(time, off);
return time_fixoff(time);
}
return time_localtime(time);
}