Am Mittwoch, 23. MÁ” 2005, 06:09:50 +0900 schrieb Arfin:
> Is there some kind of class to format numbers? Something to let you
> transform:
> 
> 1	=>	"0001"

"%04d" % 1

> class Integer
> 	def addZero
> 		return "0" + self.to_s if self.to_s.length == 1
> 		return self.to_s
> 	end
> end
> t = Time.now
> p "The date is: #{t.year}#{t.month.addZero}#{t.day.addZero}"

Time.strftime "%Y%m%d"

Bertram

-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de