How to format date from string?

Posted by 4thSpace on Stack Overflow See other posts from Stack Overflow or by 4thSpace
Published on 2010-05-16T21:57:14Z Indexed on 2010/05/16 22:00 UTC
Read the original article Hit count: 158

I have a string with this value:

2010-05-13 23:17:29

I'd like to format it and am using the following code:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateStyle = NSDateFormatterMediumStyle;
NSDate *formattedDate = [formatter dateFromString:dateString];
[formatter release];

When the debugger reaches the release line, formattedDate shows "invalid CFStringRef" and

Cannot access memory at address 0x0

Any ideas what I'm doing wrong?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk