I am trying to convert a NSString into a double using the following:
double lastSynced;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-DD HH:MM:SS"];
NSDate *dateFromString = [[NSDate alloc] init];
dateFromString = [dateFormatter dateFromString:@"2012-03-28 18:41:25"];
lastSynced = [dateFromString timeIntervalSince1970];
However when printing lastSynced it always gives me 0. Why is this?
Your date format is wrong. Should be: