tags:

views:

20

answers:

2

Hi,

I have a string in this format "dd.mm.yy" (23.08.10). I would like to convert them to a Date format using

NSDate *currentDate = [[NSDate alloc] initWithString:new.date];

But i need a format like this: "yyyy-mm-dd HH:MM:ss +0000" to compare two dates! How can I do that? I know that I have to user NSDateFormatter but I dont know how to use it.

Thanks

A: 

NSDateFormatter* dateformatter = [[NSDateFormatter alloc] init];
[dateformatter setDateFormat:@"dd.MM.yy"];
NSDate *date = [dateformatter dateFromString:dateString];
[dateformatter release];

Have a look at the date markup.

Date_Format_Patterns

Jerry Jones
A: 

So great! Thank you so much! It's working now!

CU

swissmade