0

I have fetched date as NSString from database. It is in 24 hour's format. When I print the time that is fetched from the database, it is 06:26:00. Now when I try to convert it with following code, it gives me something really weird.

   NSDateFormatter *dateFormatttor = [[NSDateFormatter alloc] init];
    [dateFormatttor setDateFormat:@"HH:mm:ss"];
    NSDate *time = [dateFormatttor dateFromString:@"06:26:00"];
    NSLog(@"%@", time); //  it prints out 2000-01-01 00:26:00 +0000

I need to compare current time with the formatted time. So, I need it to be converted properly. Can anyone please help.

Natasha
  • 6,651
  • 3
  • 36
  • 58

0 Answers0