iphone - Convert NSString to NSDate returns (null) value -


I have a date in the string format " 2013-03-19T19: 00: 50 " I am trying to convert it to NSDate in NSDateFormatter NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init] ; [DateFormatter setDateFormat: @ "yyyy-MM-ddThh: mm: SS"]; NSDate * startDate = [dateFormatter dateFromString: date]; NSLog (@ "date format date:% @", start-up);

but it is giving me a redundant date

  Date in date format: (empty)   

is what The issue?

Use:

  [dateFormatter setDateFormat: @ "yyyy - MM-dd'T'HH: mm: ss "];   

You have time in 24 hour format, so HH is required <12> There is an added text on it.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -