mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
250b86bbee
commit
62fc81fe12
1 changed files with 1 additions and 10 deletions
|
@ -179,21 +179,12 @@ module CGI::Util
|
|||
# Synonym for CGI.unescapeElement(str)
|
||||
alias unescape_element unescapeElement
|
||||
|
||||
# Abbreviated day-of-week names specified by RFC 822
|
||||
RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
|
||||
|
||||
# Abbreviated month names specified by RFC 822
|
||||
RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]
|
||||
|
||||
# Format a +Time+ object as a String using the format specified by RFC 1123.
|
||||
#
|
||||
# CGI.rfc1123_date(Time.now)
|
||||
# # Sat, 01 Jan 2000 00:00:00 GMT
|
||||
def rfc1123_date(time)
|
||||
t = time.clone.gmtime
|
||||
return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
|
||||
RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
|
||||
t.hour, t.min, t.sec)
|
||||
time.getgm.strftime("%a, %d %b %Y %T GMT")
|
||||
end
|
||||
|
||||
# Prettify (indent) an HTML string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue