NSDateFormatter formatting the time

Discussion in 'iOS Programming' started by erdinc27, Sep 6, 2016.

  1. erdinc27 macrumors regular

    Joined:
    Jul 20, 2011
    #1
    i have such a string "17:22:19" i need to convert it to time and countdown. I try to format it with NSDateFormatter but the result is always nil. Here how my code looks.
    Code:
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"HH:mm:ss";
    NSDate *theTime = [formatter dateFromString:@"17:22:19"];
    how can i convert it to time and countdown by timer ?
     
  2. jgaz macrumors member

    jgaz

    Joined:
    Dec 30, 2007
    Location:
    Colorado
    #2
  3. erdinc27 thread starter macrumors regular

    Joined:
    Jul 20, 2011
    #3
    Thank you for reply. I think i formatted it correctly but i made a mistake when i try to log the date. So i found it out.
     

Share This Page