views:

227

answers:

1

I am trying to take a date string and turn it into a specific NSDate (eg. July 1, 1981), but I don't see and methods for setting the date. Does anyone know how to accomplish this? Perhaps convert a DateTime object to NSDate?

A: 

You want to look at the NSDateFormatter class :)

Your code will look something like this . . .

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MMM dd, yyyy HH:mm"];

NSDate *parsed = [formatter dateFromString:dateString];

S

PS Example liberally copied from this question :)

deanWombourne
I will look into setting the date using the NSDateFormatter. Monotouch does not have all of the methods of objective C, but it look like a step in the right direction. Thanks Dean
Bryan
deanWombourne