This could be repeated one but I am not able to find the correct solution.
NSDateFormatter *dateFormat = [[[NSDateFormatter alloc] init] autorelease];
[dateFormat setDateFormat:@"YYYY-MM-dd"];
NSString *dateString = [dateFormat stringFromDate:receiveddate];
NSLog(@"Date: %@", dateString);
receiveddate is NSDate and its value is 2012-06-11 00:00:00 +0000
I just want to convert the above date into NSString where value should be just 2012-06-11
But when I checked it out it gives me different output that is 2012-00-11 00:00:00. It’s strange. How can I get out from this problem.
Hi I am using the same code what you have posted and it’s giving me the right output what You want. So i think the problem with the format of your receiveddate. Here is tha code what i m using