Released: RelativeTime

Ruby has a nifty little function called time_ago_in_words. You pass it an arbitrary number of seconds and it gives you back something friendly like “about 2 weeks ago”.

Today, I implemented a similar routine for .NET.

relativetime.codeplex.com

nuget.org/List/Packages/relativetime

To use it, just include the namespace, then call ToHumanTime() on a TimeSpan object.

If you want more of an idea of what it generates, take a look at the test suite.

2 thoughts on “Released: RelativeTime

  1. That’s a great one, Tatham
    Thanks a lot for the library and mention of the other service. Checking both…

    I had the same problem early 2010, and used another similar service, http://www.purl.org

    It gave me URLs like:
    http://purl.org/net/spiurl/meligy

    But was always feeling a bit worried about using a random free service like this. The good thing is I never caught it falling, but you never know what’s coming…

Comments are closed.