[![CI Status](http://img.shields.io/travis/Minh Hoang/EasyNSDateHandler.svg?style=flat)](https://travis-ci.org/Minh Hoang/EasyNSDateHandler)
This library is created for avoiding boilerplate code when dealing with NSDate creation and output. When creating a NSDate from day month year, you have to declare a NSCalendar and NSDateComponent, when you'd like to get a NSString from a NSDate, you have to create a NSDateFormatter. This will save you time from creating those one-time-used objects.
iOS ~> 6.0 or later
EasyNSDateHandler is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "EasyNSDateHandler"
Or just copy files from Pod/Classes into your project.
-
Include NSDate+EasyDatetimeHandler.h header
-
Create a NSDate from given year, month, date
+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day;
- Get NSString output from NSDate object
- (NSString *)toStringWithDateFormat:(NSDateToStringFormatOrderByComponent)format dateComponentSeparator:(NSString *)separator;
The NSDateToStringFormatOrderByComponent enum as below
typedef NS_ENUM(NSInteger, NSDateToStringFormatOrderByComponent) {
NSDateToStringFormatOrderByYearMonthDate,
NSDateToStringFormatOrderByYearDateMonth,
NSDateToStringFormatOrderByMonthDateYear,
NSDateToStringFormatOrderByDateMonthYear,
NSDateToStringFormatOrderByYearMonth,
NSDateToStringFormatOrderByMonthYear,
NSDateToStringFormatOrderByDateMonth,
NSDateToStringFormatOrderByMonthDate
};
Kaopiz Software Co., Ltd.
EasyNSDateHandler is available under the MIT license. See the LICENSE file for more info.