From: Tyler Eaves Date: 2005-05-26T13:20:18+09:00 Subject: Re: Zerofy On Wed, 25 May 2005 14:24:17 -0700, aartist wrote: > How I can zerofy the day and month. I like to add 0 in the beginning. > Now an object cannot have 0 at the beginning unless it is a string > object in this context. I think the real problem here is that maybe you aren't quite comfortable with the typing system. Fixnums are designed for mathematical manipulation. Strings (in this context) are generally used for display. So basically you want to hold off on converting to a string for as long as possible. Generally, there's no need to do an explicit conversion. You'll generally just use printf or something when you need to display it, but you'll keep the integer as the actual object. irb(main):001:0> a = 3 => 3 irb(main):002:0> printf("%02d\n",a) 03 => nil