Printing an NSDate
Printing an NSDate
- Subject: Printing an NSDate
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Thu, 19 Jan 2012 13:41:54 +0700
I want to print a date on iOS 5.0.1 ignoring the locale.
(this is for logging - not for showing strings to users)
I assume that NSDate has no sufficient parameters to control the output.
So I tried to use NSDateFormatter.
The desired output is something like:
NSString *template = @"HH:mm:ss EEE dd. MMM yyyy zzz";
NSString *dateFormat = [ NSDateFormatter dateFormatFromTemplate: template options: 0 locale: nil ];
NSDateFormatter *dateFormatter = [ [ NSDateFormatter alloc ] init ];
[ dateFormatter setDateFormat: dateFormat ];
NSString *dateString = [ dateFormatter stringFromDate: someDate ];
[ dateFormatter release ];
1. problem:
The date gets output as year, month, day which is NOT what I specified.
2. problem:
The output is: date time, NOT time date as requested.
What am I doing wrong?
Kind regards,
Gerriet.
_______________________________________________
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