How to give a input date format in iphone

Posted by Pugal Devan on Stack Overflow See other posts from Stack Overflow or by Pugal Devan
Published on 2010-03-08T11:20:19Z Indexed on 2010/03/08 11:36 UTC
Read the original article Hit count: 341

Filed under:
|
|
|
|

Hi, 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.

© Stack Overflow or respective owner

Related posts about nsdateformatter

Related posts about input