CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

FRDateFormatterCache 0.2.0

FRDateFormatterCache 0.2.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2015

Maintained by Jonathan Dalrymple.



  • By
  • Jonathan Dalrymple

FRDateFormatter

Simple category on NSDateFormatter to offer methods to convert dates to and from string.

To convert a date into a string, you use the following

NSString *string = [NSDateFormatter stringWithFormat:@"YYYY" date:[NSDate date]];

And if you wish to do the inverse

NSDate *date = [NSDateFormatter dateWithFormat:@"YYYY" string:@"2015"]

The category will create a date formatter with the given format and keep it in an internal NSCache, reusing it whenever another operation is requested using the same method and format.

Formatters are shared between both methods. So in the examples above only one formatter would be created globally.

Get in Contact

Twitter Email