Method: ActiveSupport::TimeWithZone#utc?

Defined in:
lib/active_support/time_with_zone.rb

#utc?Boolean Also known as: gmt?

Returns true if the current time zone is set to UTC.

Time.zone = 'UTC'                           # => 'UTC'
Time.zone.now.utc?                          # => true
Time.zone = 'Eastern Time (US & Canada)'    # => 'Eastern Time (US & Canada)'
Time.zone.now.utc?                          # => false

Returns:

  • (Boolean)


115
116
117
# File 'lib/active_support/time_with_zone.rb', line 115

def utc?
  zone == "UTC" || zone == "UCT"
end