you can use the above code snippets using NSDate will result in today's date and current time ...
NSDate * dmd = [NSDate date];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"yyyy-MM-dd"]; NSString *dateString = [dateFormatter stringFromDate:dmd]; NSArray *temp=[dateString componentsSeparatedByString:@""]; NSLog(@"%@",[temp objectAtIndex:1]);
source share