English 中文(简体)
MongoMapper返回的T和Z是什么时候?
原标题:What is the T and Z in timedate getting returned by MongoMapper?
  • 时间:2012-05-11 00:45:39
  •  标签:
  • ruby
  • mongodb

当我回去一份创建的“灯塔”格式时;从MongoMapper那里得到更新,这是我看到的一个实例。

updated_at>:"2012-04-25T16:25:05Z"

什么是T(时间?)和Z?

 irb(main):009:0> Story.last.created_at
  DEBUG - MONGODB (0ms) prototype_development[ stories ].find({}).limit(-1)
=> 2012-04-25 16:24:26 UTC
irb(main):010:0> Story.last.created_at.to_s
  DEBUG - MONGODB (0ms) prototype_development[ stories ].find({}).limit(-1)
=> "2012-04-25 16:24:26 UTC"
irb(main):011:0> JSON.parse(Story.last.to_json)[ created_at ]
  DEBUG - MONGODB (0ms) prototype_development[ stories ].find({}).limit(-1)
=> "2012-04-25T16:24:26Z"
最佳回答

http://en.wikipedia.org/wiki/ISO_8601“ISO8601

标题:

> require  time  #=> true
> Time.now.utc.iso8601 #=> "2012-05-11T01:28:51Z"

From Wikipedia:

The UTC time zone is sometimes denoted by the letter Z—a reference to the equivalent nautical time zone (GMT), which has been denoted by a Z since about 1950. The letter also refers to the "zone description" of zero hours, which has been used since 1920 (see time zone history). Since the NATO phonetic alphabet and amateur radio word for Z is "Zulu", UTC is sometimes known as Zulu time. This is especially true in aviation, where Zulu is the universal standard. This ensures all pilots regardless of location are using the same 24-hour clock, thus avoiding confusion when flying between time zones.See list of military time zones for letters used in addition to Z in qualifying time zones other than Greenwich.

问题回答

暂无回答




相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签