iphone - How to convert a string into an NSDate? -


Assuming that I have something like 30-10-2025 12:53 How can I change? That to an NSDate? I think there is something like this that takes a format string that tells how the date looks like a string, so it can parse ... Where should I look?

You can use NSDateFormatter

  NSDateFormatter * k = [[NSDateFormatter alloc] init]; [K: setFormat: @ "your string format"] / / "@mm / dd / yy hh: mm: ss" NSDate * d = [k dateFromString: yourString]; [K release]  

This is a reference


Comments