From: Vance A Heron Date: 2005-05-15T17:53:05+09:00 Subject: Re: Formatting date without leading zeros Tom, The best I could come up with is ... heron $ irb irb(main):001:0> t=Time.local(2005,'jan',4,9,05,0,0) => Tue Jan 04 09:05:00 PST 2005 irb(main):002:0> t.strftime('%b %d %Y %H:%M').gsub(/ 0(\d\D)/, ' \1') => "Jan 4 2005 9:05" irb(main):003:0> Hope this helps. Vance On Sun, 2005-05-15 at 17:10 +0900, Tom Reinhart wrote: > I've tried to do the best research I can into this before posting here, > but I have come up relatively short. I would like to format a DateTime > such that the day of the month and hours that are less than ten are not > prefixed with a leading zero (ex. Jan 4 9:30 and not Jan 04 09:30). > > Is there any way to use DateTime#strftime to do this, or any > alternative short of piecing the bits together with calls like > thedate.month + " " + thedate.day? > > Thank you. > > Sincerely, > > Tom Reinhart > tom@alltom.com > http://alltom.com/ > >