diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-18 22:01:12 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-18 22:01:12 +0000 |
commit | 720a23df0a4230dfeccce9911bd2eae4a303e19a (patch) | |
tree | be734ac2f1780bb3310d9cdb2f9c1a157fa6c152 /lib/date | |
parent | 91c798b670d3408db607dba74d782dc95982f23a (diff) | |
download | ruby-720a23df0a4230dfeccce9911bd2eae4a303e19a.tar.gz |
synchronized with date2 3.5.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/date')
-rw-r--r-- | lib/date/format.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/date/format.rb b/lib/date/format.rb index f00f60ab47..d3d8d17511 100644 --- a/lib/date/format.rb +++ b/lib/date/format.rb @@ -1,5 +1,5 @@ -# format.rb: Written by Tadayoshi Funaba 1999-2003 -# $Id: format.rb,v 2.9 2003-04-19 19:19:35+09 tadf Exp $ +# format.rb: Written by Tadayoshi Funaba 1999-2004 +# $Id: format.rb,v 2.12 2004-01-19 05:43:28+09 tadf Exp $ class Date @@ -501,8 +501,14 @@ class Date when '%x'; o << strftime('%m/%d/%y') when '%Y'; o << '%.4d' % year when '%y'; o << '%02d' % (year % 100) - when '%Z'; o << zone - when '%z'; o << zone # ID + when '%Z'; o << (if offset.zero? then 'Z' else strftime('%z') end) + when '%z' # ID + o << if offset < 0 then '-' else '+' end + of = offset.abs + hh, fr = of.divmod(1.to_r/24) + mm = fr / (1.to_r/1440) + o << '%02d' % hh + o << '%02d' % mm when '%%'; o << '%' when '%+'; o << strftime('%a %b %e %H:%M:%S %Z %Y') # TZ when '%1'; o << '%d' % jd |