mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/date/lib/date/format.rb: Document date formats. Patch by
Clinton Nixon. [Ruby 1.9 - Bug #4743] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
78cd4749d8
commit
f8488a270f
2 changed files with 29 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat May 21 02:22:34 2011 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* ext/date/lib/date/format.rb: Document date formats. Patch by
|
||||||
|
Clinton Nixon. [Ruby 1.9 - Bug #4743]
|
||||||
|
|
||||||
Fri May 20 05:15:19 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
|
Fri May 20 05:15:19 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
|
||||||
|
|
||||||
* gc.c: Fix build on m68k by 'error: too few arguments to
|
* gc.c: Fix build on m68k by 'error: too few arguments to
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
#--
|
||||||
# format.rb: Written by Tadayoshi Funaba 1999-2011
|
# format.rb: Written by Tadayoshi Funaba 1999-2011
|
||||||
|
#++
|
||||||
|
|
||||||
class Date
|
class Date
|
||||||
|
|
||||||
|
@ -110,22 +112,44 @@ class Date
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns a String representing this Date in the form:
|
||||||
|
# Sun Sep 30 00:00:00 1977.
|
||||||
def asctime() strftime('%c') end
|
def asctime() strftime('%c') end
|
||||||
|
|
||||||
alias_method :ctime, :asctime
|
alias_method :ctime, :asctime
|
||||||
|
|
||||||
|
# Returns a String representing this Date in the form:
|
||||||
|
# 1977-09-30.
|
||||||
|
#
|
||||||
|
# This form is in accordance with
|
||||||
|
# ISO8601[http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/date_and_time_format.htm].
|
||||||
def iso8601() strftime('%F') end
|
def iso8601() strftime('%F') end
|
||||||
|
|
||||||
|
# Returns a String representing this Date in the form:
|
||||||
|
# 1977-09-30T00:00:00+00:00
|
||||||
|
#
|
||||||
|
# This form is in accordance with the format for a timestamp in
|
||||||
|
# RFC3339[http://www.ietf.org/rfc/rfc3339.txt].
|
||||||
def rfc3339() strftime('%FT%T%:z') end
|
def rfc3339() strftime('%FT%T%:z') end
|
||||||
|
|
||||||
|
# Synonym for Date.iso8601.
|
||||||
def xmlschema() iso8601 end # :nodoc:
|
def xmlschema() iso8601 end # :nodoc:
|
||||||
|
|
||||||
|
# Returns a String representing this Date in the form:
|
||||||
|
# Fri, 30 Sep 1977 00:00:00 +0000
|
||||||
|
#
|
||||||
|
# This form is in accordance with the format for a full
|
||||||
|
# date and time specification in
|
||||||
|
# RFC2822[http://www.ietf.org/rfc/rfc2822.txt].
|
||||||
def rfc2822() strftime('%a, %-d %b %Y %T %z') end
|
def rfc2822() strftime('%a, %-d %b %Y %T %z') end
|
||||||
|
|
||||||
alias_method :rfc822, :rfc2822
|
alias_method :rfc822, :rfc2822
|
||||||
|
|
||||||
def httpdate() new_offset(0).strftime('%a, %d %b %Y %T GMT') end # :nodoc:
|
def httpdate() new_offset(0).strftime('%a, %d %b %Y %T GMT') end # :nodoc:
|
||||||
|
|
||||||
|
# Returns a String representing this Date in a form
|
||||||
|
# that is in accordance with the Japanese specification
|
||||||
|
# JIS X 0301.
|
||||||
def jisx0301
|
def jisx0301
|
||||||
if jd < 2405160
|
if jd < 2405160
|
||||||
strftime('%F')
|
strftime('%F')
|
||||||
|
|
Loading…
Reference in a new issue