Created
December 1, 2016 16:39
-
-
Save monsoir/1173d23c1ffaddd53779b22f7a2fd21b to your computer and use it in GitHub Desktop.
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
NSCalendar *calendar = [NSCalendar currentCalendar]; | |
NSDateComponents *dateComponents = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:[[NSDate alloc] init]]; | |
[dateComponents setMonth:dateComponents.month - 1]; | |
NSDate *lastMonthDate = [calendar dateFromComponents:dateComponents]; | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
dateFormatter.dateFormat = @"yyyyMM"; | |
lastMonthDateString = [dateFormatter stringFromDate:lastMonthDate]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment