class Time def stamp( fmt = nil ) case fmt when :db, :dbase, :database, :utc strftime("%Y-%m-%d %H:%M:%S") when :short strftime("%e %b %H:%M") when :long strftime("%B %e, %Y %H:%M") when :day1st, :dmYHM # TODO generalize strftime("%d-%m-%Y %H:%M") when String strftime( fmt ).strip else strftime("%a %b %d %H:%M:%S %Z %Y") end end def self.stamp(*args) now.stamp(*args) end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' require 'time' class TCTime < Test::Unit::TestCase def setup @t = Time.parse('4/20/2005 15:37') end def test_stamp assert_equal( "Wed Apr 20 15:37:00 EDT 2005", @t.stamp ) end end =end