Reputation: 67
Tried converting NSString with the date 'Saturday 22 August 2015 17:30' to NSDate but it comes out with '2014-12-27 17:30:00 UTC'. I don't even care that the format comes out wrong, i just want it to convert it to NSDate correctly.
currentFixtures.timeDate is a NSString containing 'Saturday 22 August 2015 17:30' fixtureDate is an NSDate that comes back with '2014-12-27 17:30:00 UTC'
NSDateFormatter *dateFormatFixture = [[NSDateFormatter alloc]init];
[dateFormatFixture setDateFormat:@"EEEE d MMMM YYYY HH:mm"];
[dateFormatFixture setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en-GB"]];
[dateFormatFixture setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
NSDate *fixtureDate = [[NSDate alloc] init];
fixtureDate = [dateFormatFixture dateFromString:currentFixture.timeDate];
Upvotes: 2
Views: 89