Topic: Convert month to double-digit

I am using Ruby to generate a url within my Rails app...

http://domain.com/<%= @movie.year %>/<%= @movie.month %>/<%= @movie.file_name %>

The @movie.month is coming out as "4" instead of "04". Anyone know of a way to have this expressed as two digits so a leading zero is displayed?

Thanks!

Last edited by jman (2007-04-14 02:00:31)

Re: Convert month to double-digit

<%= @movie.year + "/" + @movie.month.strftime("%m") + "/" + @movie.file_name %>

BrewControl.com - Brewery and Brewpub management powered by RoR

Re: Convert month to double-digit

thanks! that does it...