summaryrefslogtreecommitdiff
path: root/lib/time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-21 18:08:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-21 18:08:47 +0000
commitd9dd33fc27fc2108e78dd60cc0b37042bd39f5fd (patch)
tree3a6fce7f5f26e2fa76b106aeb470dcb3aa3fbb31 /lib/time.rb
parent6df2f3d59c0222c3be5623cb03ab05c333d7f2bf (diff)
* lib/time.rb (Time#rfc2822): pad leading zeros for year.
(Time#httpdate): ditto. (Time#xmlschema): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/time.rb')
-rw-r--r--lib/time.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/time.rb b/lib/time.rb
index da5bec9ff3..37da4e381d 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -445,7 +445,7 @@ class Time
# If +self+ is a UTC time, -0000 is used as zone.
#
def rfc2822
- sprintf('%s, %02d %s %d %02d:%02d:%02d ',
+ sprintf('%s, %02d %s %04d %02d:%02d:%02d ',
RFC2822_DAY_NAME[wday],
day, RFC2822_MONTH_NAME[mon-1], year,
hour, min, sec) +
@@ -477,7 +477,7 @@ class Time
#
def httpdate
t = dup.utc
- sprintf('%s, %02d %s %d %02d:%02d:%02d GMT',
+ sprintf('%s, %02d %s %04d %02d:%02d:%02d GMT',
RFC2822_DAY_NAME[t.wday],
t.day, RFC2822_MONTH_NAME[t.mon-1], t.year,
t.hour, t.min, t.sec)
@@ -498,7 +498,7 @@ class Time
# Its default value is 0.
#
def xmlschema(fraction_digits=0)
- sprintf('%d-%02d-%02dT%02d:%02d:%02d',
+ sprintf('%04d-%02d-%02dT%02d:%02d:%02d',
year, mon, day, hour, min, sec) +
if fraction_digits == 0
''