[digdog dig];

  • Archive
  • RSS

Relative date for NSDate

NSDate does not have relative date method, so you will need to use NSCalendar to compare with current time, get the NSDateComponents return, and check those date selectors one by one.

Instead of checking them manually, I create a NSArray that holds the name of those selectors, and use NSInvocation to find out first non-zero result, and return it as relative date.

Where to download

The source code is available on github.

    • #Objective-C
    • #category
    • #NSDate
    • #NSDateComponents
    • #NSCalendar
  • 3 years ago
  • 3
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

3 Notes/ Hide

  1. wisesabre reblogged this from digdog
  2. drugsrdrugs likes this
  3. fortmyers likes this
  4. digdog posted this
← Previous • Next →

[digdog dig];

MAKE A POO-POO AND COME UP WITH A FRESH NEW IDEA
  • RSS
  • Random
  • Archive
  • Mobile
Effector Theme by Pixel Union