End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Time#gmt?
time.gmt? → true or false
time.c
View on GitHub ↗
static VALUE
time_utc_p(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
return RBOOL(TZMODE_UTC_P(tobj));
}
Alias of #utc?
Returns true if time represents a time in UTC (GMT).
Example
t = Time.now #=> 2007-11-19 08:15:23 -0600 t.utc? #=> false t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC t.utc? #=> true t = Time.now #=> 2007-11-19 08:16:03 -0600 t.gmt? #=> false t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC t.gmt? #=> true