I was sort of thinking the same, and I tried a few others, i.e. MM-dd-yyyy and passing in the date string in a matching layout, but it also didn't work. I've seen this same example else where, so I think it's supposed to work. My understanding is, the date string must match the format specifier.
thanks for the response though ! Steven On 2013-02-10, at 8:28 PM, Chan Maxthon wrote: > Maybe the format string is bad? > > 发自我的 iPhone > > 在 2013-2-11,5:01,Steven LeMaire <[email protected]> 写道: > >> Hi Everyone, >> >> I really don't understand why the code below isn't working for me. I've >> tried setting a locale and timezone on the date formatter, but it's had no >> affect. >> I'm running this on Slackware 13.37, I've just updated to the latest stable >> version of GNUstep also. >> Any help would be appreciated ! >> >> Thanks >> Steven >> >> #import <Foundation/Foundation.h> >> #import <Foundation/NSDate.h> >> #import <Foundation/NSDateFormatter.h> >> int >> main(int argc, const char *argv[]) { >> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; >> >> >> NSDate *d; >> NSDateFormatter *df = [[NSDateFormatter alloc] init]; >> [df setDateFormat:@"yyyyMMdd"]; >> d = [df dateFromString:@"20130215"]; >> >> NSLog(@"d is: %@", d); >> >> [pool release]; >> >> return 0; >> } >> _______________________________________________ >> Gnustep-dev mailing list >> [email protected] >> https://lists.gnu.org/mailman/listinfo/gnustep-dev _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
