зеркало из https://github.com/github/ruby.git
* lib/rss/rss.rb: [DOC] document Time#w3cdtf by @steveklabnik
[Bug #8821] ありがとうかににく git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
04e8c4eed7
Коммит
34cbe5ac06
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Nov 9 14:50:09 2013 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
|
* lib/rss/rss.rb: [DOC] document Time#w3cdtf by @steveklabnik
|
||||||
|
[Bug #8821] ありがとうかににく
|
||||||
|
|
||||||
Sat Nov 9 14:29:04 2013 Zachary Scott <e@zzak.io>
|
Sat Nov 9 14:29:04 2013 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
* ext/dl/cfunc.c: [DOC] fix typo in example [Bug #8944]
|
* ext/dl/cfunc.c: [DOC] fix typo in example [Bug #8944]
|
||||||
|
|
|
@ -3,6 +3,14 @@ require "time"
|
||||||
class Time
|
class Time
|
||||||
class << self
|
class << self
|
||||||
unless respond_to?(:w3cdtf)
|
unless respond_to?(:w3cdtf)
|
||||||
|
# This method converts a W3CDTF string date/time format to Time object.
|
||||||
|
#
|
||||||
|
# The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime
|
||||||
|
#
|
||||||
|
# Time.w3cdtf('2003-02-15T13:50:05-05:00')
|
||||||
|
# # => 2003-02-15 10:50:05 -0800
|
||||||
|
# Time.w3cdtf('2003-02-15T13:50:05-05:00').class
|
||||||
|
# # => Time
|
||||||
def w3cdtf(date)
|
def w3cdtf(date)
|
||||||
if /\A\s*
|
if /\A\s*
|
||||||
(-?\d+)-(\d\d)-(\d\d)
|
(-?\d+)-(\d\d)-(\d\d)
|
||||||
|
@ -34,6 +42,13 @@ class Time
|
||||||
end
|
end
|
||||||
|
|
||||||
unless method_defined?(:w3cdtf)
|
unless method_defined?(:w3cdtf)
|
||||||
|
# This method converts a Time object to a String. The String contains the
|
||||||
|
# time in W3CDTF date/time format.
|
||||||
|
#
|
||||||
|
# The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime
|
||||||
|
#
|
||||||
|
# Time.now.w3cdtf
|
||||||
|
# # => "2013-08-26T14:12:10.817124-07:00"
|
||||||
def w3cdtf
|
def w3cdtf
|
||||||
if usec.zero?
|
if usec.zero?
|
||||||
fraction_digits = 0
|
fraction_digits = 0
|
||||||
|
|
Загрузка…
Ссылка в новой задаче