How to specify input date format in iphone

I am new to iphone development. My input date format is "2010-03-05T18: 20: 40Z" and I don’t know how to specify the input format of my code. So what I mentioned in my code (?).

input date format = "2010-03-05T18: 20: 40Z"

Here is my code:

NSString *indate = @"2010-03-05T18:20:40Z"; NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; [inputFormatter setDateFormat:@"????????????????????????"]; NSDate *inputDate = [inputFormatter dateFromString:indate]; NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; [outputFormatter setDateFormat:@"EEE. MMM. d, yyyy"]; NSString *outputDate = [outputFormatter stringFromDate:inputDate]; lDate.text = outputDate; 

Plz help me.

Thanks.

+6
date input format iphone nsdateformatter
source share
1 answer

try formatting NSDate to specific styles for year, month, day and hour, minute, second

 "yyyy-MM-dd'T'HH:mm:ss'Z'" 
+3
source share

All Articles