The Ruby on Rails experts

Dec 7, 2008

I have used strftime a lot lately on one of my projects. I could not find a user friendly reference for strftime, so I wrote one. Here is my user friendly strftime cheat sheet in PDF format:

strftime reference

In case you are wondering what strftime does: It allows you to represent a date/time as a formatted string. Example:'%A, %l:%M %p')
=> "Friday,  9:06 AM"

And here is some handy Ruby code to look at the options for strftime:

def print_line(char)
  puts "%#{char}: #{"%#{char}")}"

('a'..'z').each do |char|