Displaying a scaling, relative time or date
Displaying a scaling, relative time or date
- Subject: Displaying a scaling, relative time or date
- From: Graham Cox <email@hidden>
- Date: Thu, 08 Jan 2015 11:18:10 +1100
I want a label in my interface to display a relative time using a "sensible" approximate scale depending on the value. I'm not sure if I can use NSDateFormatter for this - it seems it's a bit too fixed in using only the units you assign.
For example, if the value is less than a minute, it should say "x seconds ago", if it's in the range of 1-59 minutes, "x minutes ago", "about an hour ago", "x hours ago", "yesterday", "x days ago", "about a week ago", "x weeks ago", "about a month ago", "x months ago" - you get the picture. Is this possible using NSDateFormatter, or do I have to roll my own for this?
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden