NSDate *todayDate = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"MMMM-dd-yyyy"];
NSString *today = [dateFormat stringFromDate:todayDate];
NSLog(@"today is %@",today);
NSDate *yesterdayDate = [todayDate dateByAddingTimeInterval: -86400.0];
NSString *yesterday = [dateFormat stringFromDate:yesterdayDate];
NSLog(@"yesterday was %@",yesterday);
NSString *yourDate = [NSString stringWithFormat:@"January-08-2017"];
if ([yourDate isEqualToString:yesterday]) {
NSLog(@"yesterday");
}
else if ([yourDate isEqualToString:today])
{
NSLog(@"today");
}
else
{
NSLog(@"the date is %@",yourDate);
}
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"MMMM-dd-yyyy"];
NSString *today = [dateFormat stringFromDate:todayDate];
NSLog(@"today is %@",today);
NSDate *yesterdayDate = [todayDate dateByAddingTimeInterval: -86400.0];
NSString *yesterday = [dateFormat stringFromDate:yesterdayDate];
NSLog(@"yesterday was %@",yesterday);
NSString *yourDate = [NSString stringWithFormat:@"January-08-2017"];
if ([yourDate isEqualToString:yesterday]) {
NSLog(@"yesterday");
}
else if ([yourDate isEqualToString:today])
{
NSLog(@"today");
}
else
{
NSLog(@"the date is %@",yourDate);
}
Sign up here with your email
ConversionConversion EmoticonEmoticon