NSDate *today=[NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"M"];
NSString *currentMonth = [dateFormatter stringFromDate:today];
//currentMonth will be 1 for Jan, 2 for Feb etc
NSLog(@"currentMonth=%@",currentMonth);
[dateFormatter release];
No comments:
Post a Comment