Search code examples
ruby-on-railsrubyruby-on-rails-3ruby-on-rails-4ruby-on-rails-5

How to see UTC time using ruby on rails


I have been using this for Time.now for fetching current time. But this shows current time as per my country. Now I want to see current time according to UTC How do I do that in ruby.


Solution

  • It's simple. Just use

    Time.now.utc