Ruby - time.now in UTC

Ruby

Ruby Problem Overview


> Possible Duplicate:
> How do I Convert DateTime.now to UTC in Ruby?

How do I get current time in Date-time-milliseconds & UTC? Ex. 2012-03-22T18:48:40.873Z

I tried -

Time.now.utc_offset.to_s
Time.now.xs_datetime

Ruby Solutions


Solution 1 - Ruby

Time.now.utc is what you must be using.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMajorisView Question on Stackoverflow
Solution 1 - Rubyhemanth.hmView Answer on Stackoverflow