How to read NSDate from a string?

I have dates strings and you want to parse them in NSDate objects. Is there any way to do this? I watched NSDate and NSScanner, and did not see anything to read it from the line.

+1
source share
2 answers

In cocoa sdk, this is usually the case: if you want to have a date and have a string, look in the Date class for the create method that accepts the string.

[ NSDateFormatter dateFromString: myString]

dateFromString:

Returns a date representation. This string is interpreted using the current receiver settings.

(NSDate *) dateFromString: (NSString *) string

, , NSString Static, stringFromDate ( , , ). , NSDateFormatter , .

+2
+1

All Articles