From: Michael N. <mne...@us...> - 2003-05-09 19:54:32
|
Update of /cvsroot/ruby-dbi/src/lib/dbi In directory sc8-pr-cvs1:/tmp/cvs-serv6282 Modified Files: dbi.rb Log Message: zero-pad date/time/timestamps (classes Date/Time/Timestamp method to_s) Index: dbi.rb =================================================================== RCS file: /cvsroot/ruby-dbi/src/lib/dbi/dbi.rb,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- dbi.rb 27 Apr 2003 17:42:56 -0000 1.37 +++ dbi.rb 9 May 2003 19:54:29 -0000 1.38 @@ -1,7 +1,7 @@ # # Ruby/DBI # -# Copyright (c) 2001, 2002 Michael Neumann <ne...@s-...> +# Copyright (c) 2001, 2002, 2003 Michael Neumann <mne...@nt...> # # All rights reserved. # @@ -257,7 +257,7 @@ end def to_s - "#{@year}-#{@month}-#{@day}" + sprintf("%04d-%02d-%02d", @year, @month, @day) end end @@ -290,7 +290,7 @@ end def to_s - "#{@hour}:#{@minute}:#{@second}" + sprintf("%02d:%02d:%02d", @hour, @minute, @second) end end @@ -324,7 +324,7 @@ def sec=(val) @second=val end def to_s - "#{@year}-#{@month}-#{@day} #{@hour}:#{@minute}:#{@second}.#{@fraction}" + sprintf("%04d-%02d-%02d %02d:%02d:%02d.%06d", @year, @month, @day, @hour, @minute, @second, @fraction) end def to_time |