How to give a input date format in iphone
-
18-09-2019 - |
Question
i am new to iphone development. In my input date format is "2010-03-05T18:20:40Z", and i donno to how to give a input format of my code.So i have mentioned in my code (?).
input date format = "2010-03-05T18:20:40Z"
Here my code is:
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 out.
Thanks.
Solution
try this out Formatting NSDate into particular styles for both year, month, day, and hour, minute, seconds
"yyyy-MM-dd'T'HH:mm:ss'Z'"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow