提交 eacca8d7 编写于 作者: D David Heinemeier Hansson

Added Time#to_s(:time) which will just return H:M, like 17:44 [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5628 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 619e5c29
*SVN*
* Added Time#to_s(:time) which will just return H:M, like 17:44 [DHH]
* Add Module#attr_accessor_with_default to initialize value of attribute before setting it. Closes #6538. [Stuart Halloway, Marcel Molina Jr.]
* Hash#to_xml handles keys with the same name as Kernel methods. #6613 [Catfish]
......
......@@ -8,6 +8,7 @@ module Time #:nodoc:
module Conversions
DATE_FORMATS = {
:db => "%Y-%m-%d %H:%M:%S",
:time => "%H:%M",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M",
:rfc822 => "%a, %d %b %Y %H:%M:%S %z"
......
......@@ -272,6 +272,7 @@ def test_to_s
time = Time.local(2005, 2, 21, 17, 44, 30)
assert_equal "2005-02-21 17:44:30", time.to_s(:db)
assert_equal "21 Feb 17:44", time.to_s(:short)
assert_equal "17:44", time.to_s(:time)
assert_equal "February 21, 2005 17:44", time.to_s(:long)
time = Time.utc(2005, 2, 21, 17, 44, 30)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册