NSDate *today = [NSDate date]; NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [calendar setTimeZone:[NSTimeZone timeZoneWithName:@"GMT+2"]]; NSDateComponents *dateComponents = [calendar components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today]; NSInteger day = [dateComponents day]; NSInteger month = [dateComponents month]; NSInteger year = [dateComponents year]; NSLog(@" %i %i %i ", day, month, year);
This code shows me "12 2147483647 2147483647"
How can I get the month and year (integer)
How to add / forward one day? (if we are also the first month)!
Introduce yourself for your attention :-)
source share