Qamar Suleiman
Qamar Suleiman

Reputation: 1226

dateFromString returning wrongDate

I am converting an NSString like @"12:25 AM May 27 2011" into NSDate.But as I convert it using the following code

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"hh:mm a MMM dd YYYY"];
NSDate *date = [[dateFormatter dateFromString:@"12:25 AM May 27 2011"] copy];
[dateFormatter release];

I get the wrong Date as 2010-12-25 19:25:00 +0000

Can anyone please help me around here

Upvotes: 0

Views: 115

Answers (1)

rckoenes
rckoenes

Reputation: 69469

It's not a wrong date, the time is displayed GMT hance (+0000) if you set the correct timezone very thing will be oke.

Upvotes: 1

Related Questions