Here is a little piece of python code to get the "age" of a timestamp (in other words, how much time has elapsed since then). Like what you see on Hacker News or reddit, "8 hours ago", "1 day ago", etc.
The job of this code is to figure out the "8 hours" and "1 day" part.
Here is the code (hosted as a gist on github).
I think I got some inspiration from someone's blog on the internet, but I can't find it now. Anyway the codes don't look alike IIRC and it's short, and I put it in the public domain. Do whatever you want.
The function is simple and it's not very robust, e.g. it doesn't handle the case when you pass in a date in the future. But it should be easy to extend.
And it only works for English. For something that can do i18n, you may need gettext.