In Ruby on Rails, how do I format a date with the “th” suffix, as in, “Sun Oct 5th”?

I want to display dates in the format: short day of week, short month, day of month without leading zero but including “th”, “st”, “nd”, or “rd” suffix.

For example, the day this question was asked would display “Thu Oct 2nd”.

I’m using Ruby 1.8.7, and Time.strftime just doesn’t seem to do this. I’d prefer a standard library if one exists.

7 Answers

Leave a Comment