instance method
utc
Ruby on Rails 6.0.6
Since v3.0.20Signature
utc()
Returns a Time instance of the simultaneous time in the UTC timezone.
DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600 DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
Source
# File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 180
def utc
utc = new_offset(0)
Time.utc(
utc.year, utc.month, utc.day,
utc.hour, utc.min, utc.sec + utc.sec_fraction
)
end
Defined in activesupport/lib/active_support/core_ext/date_time/calculations.rb line 180
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in DateTime