I want to display NSDates in a "human-friendly way", such as "last week", or "a few days ago". Something similar to Pretty Time for Java.
What's the best way to do this, subclassing NSDateFormatter? Before I go and reinvent the wheel, is there already some library for this?
On iOS 4 and later, use the doesRelativeDateFormatting property:
NSDateFormatter *dateFormatter = ...;
dateFormatter.doesRelativeDateFormatting = YES;
Three20's NSDateAdditions:
https://github.com/pbo/three20/blob/master/src/Three20Core/Sources/NSDateAdditions.m
.. allows you to do that as well.
EDIT: In 2013, you really don't want to use Three20 anymore. Use Regexident's solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With