How to format NSDate using NSDateFormatter (iPhone Xcode Tutorial)
So, you’re making an iPhone (or iPad) app, and want to know how to format an NSDate in Cocoa? Formatting NSDate in Objective-C is actually not too difficult. Open up Xcode and let’s get’s cracking with some Objective-C goodness!
For those who just smash up Xcode, and get cracking with their iPhone applications – I’m putting the full source code of this tutorial right here at the top:
NSDate *myDate = [NSDate date];
NSDateFormatter *df = [NSDateFormatter new];
[df setDateFormat:@"EEEE dd MMMM, yyyy"];
self.someLabel.text = [df stringFromDate:myDate];
[df release];
Read the rest of this entry »