NSDateFormatter refuses to format dates
NSDateFormatter refuses to format dates
- Subject: NSDateFormatter refuses to format dates
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 27 Sep 2011 15:41:21 +0700
The following code produces an empty string:
calender = [ [ NSCalendar autoupdatingCurrentCalendar ] retain ];
NSString *dateTemplate = @"eeeyyyyMMMMddHHmmss";
NSLocale *locale = [calender locale]; // en_IE
NSString *dateFormat = [ NSDateFormatter dateFormatFromTemplate: dateTemplate options:0 locale: locale ]; // EEE dd MMMM yyyy HH:mm:ss
dateFormatter = [ [ NSDateFormatter alloc ] initWithDateFormat: dateFormat allowNaturalLanguage: NO ];
[ dateFormatter setFormatterBehavior: NSDateFormatterBehavior10_4 ];
[ dateFormatter setLocale: locale ];
[ dateFormatter setGeneratesCalendarDates: YES ];
NSTimeZone *localTimeZone = [ calender timeZone ];
[ dateFormatter setTimeZone: localTimeZone ];
NSLog(@" now \"%@\"", [dateFormatter stringFromDate: [NSDate date]]);
What am I missing?
Kind regards,
Gerriet.
P.S. 10.7.1
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden