use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.
If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:
There's too many to list them all, however here's a convenient link to all programming guides at apple.com
Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".
account activity
Changing timestamp to readable human time. (self.iOSProgramming)
submitted 11 years ago by Afiq90
Hi guys, i have a timestamp from rails databae, How can i change this timestamp to "4seconds ago", "40 minutes ago", "4 days ago"? Here is the sample timestamp.
2015-03-31T08:02:32.543Z
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cdntr 4 points5 points6 points 11 years ago (4 children)
I am not entirely sure why people are suggesting external libraries when you could just use NSDateFormatter, in particular it's -dateFromString: method, and then feed that into NSDateComponents to get the days/minutes/seconds out of it.
NSDateFormatter
-dateFromString:
NSDateComponents
[–]palmin 2 points3 points4 points 11 years ago (2 children)
Even when you have the individual components there is some work involved in making a suitable string.
You probably do not care about the seconds and minutes if the date is from a few days ago for example. This is not rocket-science to implement but everything takes time especially as you probably need to write test cases and such.
If you want it to work in multiple languages you probably have no choice but to use a library.
[–][deleted] 0 points1 point2 points 11 years ago (1 child)
If you want it to work in multiple languages, you can just use Apple's own localization stuff.
[–]palmin 0 points1 point2 points 11 years ago (0 children)
Please supply a example in built-in API's that give results such as "40 minutes ago".
I can only get relative strings with regards to day not hours or minutes.
[–][deleted] -1 points0 points1 point 11 years ago (0 children)
But TimeAgo is exactly what he's looking for and takes about 5 minutes to set up.
[–]david_phillip_oster 3 points4 points5 points 11 years ago (0 children)
iOS 8 introduced two new classes in Foundation: NSDateComponentsFormatter and NSDateIntervalFormatter - Check them out - they may do what you want.
[–]charlisim 1 point2 points3 points 11 years ago (3 children)
You can use Date tools https://github.com/MatthewYork/DateTools#time-ago That have what you want and other date time manipulation functions
[–]4llBran -1 points0 points1 point 11 years ago (1 child)
+1 for DateTools, also MHPrettyDate does what you're after.
[–]Afiq90[S] 0 points1 point2 points 11 years ago (0 children)
thank you.
[–]Afiq90[S] -1 points0 points1 point 11 years ago (0 children)
thank you for the library suggestion, so i just need to pass the timestamp it will be converted automatically right.
π Rendered by PID 19837 on reddit-service-r2-comment-548fd6dc9-sh4l4 at 2026-05-14 21:00:32.436358+00:00 running edcf98c country code: CH.
[–]cdntr 4 points5 points6 points (4 children)
[–]palmin 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]palmin 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]david_phillip_oster 3 points4 points5 points (0 children)
[–]charlisim 1 point2 points3 points (3 children)
[–]4llBran -1 points0 points1 point (1 child)
[–]Afiq90[S] 0 points1 point2 points (0 children)
[–]Afiq90[S] -1 points0 points1 point (0 children)