KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to take a NSString date in the format "2/22/11" and convert it to this format: 2011-02-22 This is my code: NSDate *dateTemp = [[NSDate alloc] init]; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd"]; dateTemp = [dateFormat dateFromString:newInvoice.date]; newInvoice.date = [dateFormat stringFromDate:dateTemp]; newInvoice.date starts as an NSString equal to "2/22/11". dateTemp ends up NIL. newInvoice.date ends up NIL as well. I can't for the life of me figure out why.
Tags (comma-separated)
Save Edits
Cancel