diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-18 22:14:02 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-18 22:14:02 +0000 |
commit | 089aecb1490bbe182126de0c8007e1ba43c0a549 (patch) | |
tree | 7f9fd541b44b1ecd035b30bb1d6c224109871370 /lib/date | |
parent | c5c450cded45a3e61e5560f7b739489de260d548 (diff) | |
download | ruby-089aecb1490bbe182126de0c8007e1ba43c0a549.tar.gz |
synchronized with date2 3.5.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5495 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 |