Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give a input date format in iphone

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.

like image 695
Pugalmuni Avatar asked Mar 08 '10 11:03

Pugalmuni


People also ask

How do I display the date format in input?

To set and get the input type date in dd-mm-yyyy format we will use <input> type attribute. The <input> type attribute is used to define a date picker or control field. In this attribute, you can set the range from which day-month-year to which day-month-year date can be selected from.

How do I change the date format on my Iphone?

Question: Q: Change the date format to dd/mm/yyyy Answer: A: Go to Settings/General/Language & Region and choose a region where that is the standard.


1 Answers

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'"
like image 114
zapping Avatar answered Oct 13 '22 05:10

zapping