Time for strftime
Wednesday, May 16th, 2007
The strftime function is a common way for programmers to convert a computer time into a human-readable string. You can pronounce it “string-f-time”, “string-from-time”, or “string-format-time”. While Ruby and PHP each have their own implementation, the function is actually part of the Unix open spec. That’s great news for developers because it means that we can reuse the formatting techniques in any language. I’ve also found that the Ruby/Rails docs are a little lacking and you might not have known that there were more options available. Since it’s not just for Ruby, we don’t have to rely on them as our sole source of information.
Keep reading and I’ll show you how to use strftime, give you a full list of format codes (downloadable even), and demonstrate a useful helper function for working around one of the quirks of strftime.


