mamrezo
mamrezo

Reputation: 2285

How can i convert NSString to NSDate?

How can i convert NSString to NSDate?

from these Strings:

    NSString *year = @"2010";
NSString *month = @"3";
NSString *day = @"12";

to change UIDatePicker.Thanks

Upvotes: 0

Views: 571

Answers (1)

James Huddleston
James Huddleston

Reputation: 8448

NSDateFormatter can turn a string into a date. You create an NSDateFormatter object, set its format using setDateFormat: and then use its dateFromString: method to convert a string into a date.

Upvotes: 2

Related Questions