// get the current time and date week - (NSString * ) getCurrentTimeAndWeekDay { NSArray * arrWeek = [NSArray arrayWithObjects: @ " Sunday " , @ " Monday " , @ " Tuesday " , @ " Wednesday " , @ " Thursday " , @ " Friday " , @" Saturday " , nil]; NSDate * DATE = [NSDate DATE]; / * NSCalendar * Calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar]; * / //ios after 8.0 do not want to see a warning with the following NSCalendar * Calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSCalendarIdentifierGregorian]; NSDateComponents * the comps = [[NSDateComponents alloc] the init]; / * NSInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit | NSHourCalendarUnit | | NSMinuteCalendarUnit ; NSSecondCalendarUnit * / // do not want to see this with the following warning after 8.0 ios NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; the comps = [calendar components:unitFlags fromDate:date]; int week = [comps weekday]; int year=[comps year]; int month = [comps month]; int day = [comps day]; return [NSString stringWithFormat:@"%d-%d-%d %@",year,month,day,[arrWeek objectAtIndex:week]]; }