December 2, 2007...7:26 pm

Leading zeroes on Time.strftime

Jump to Comments

Not sure why this isn’t in the Ruby documentation (at least where I normally check) but the common annoyance of leading zeros on Time.strftime can be avoided simply by using “%l”.

It does come with another inconvenience though: you get a leading space instead of a leading zero…

Leave a Reply