Created
October 28, 2014 16:01
-
-
Save dreampowder/9ae1a45c57540a7a72bd to your computer and use it in GitHub Desktop.
Get Days Between two dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSInteger)getDaysBetween:(NSDate*)dateBegin | |
withDate:(NSDate*)dateEnd{ | |
NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
NSDateComponents *components = [gregorianCalendar components:NSDayCalendarUnit | |
fromDate:dateBegin | |
toDate:dateEnd | |
options:0]; | |
return [components day]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment