Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nomar383

macrumors 65816
Original poster
Okay, I'm sick of playing with this. Break it to me, what's up? This compiles fine, but I can't seem to get the date formatter to work. That NSLog displays nothing.

Code:
//create formatter and format
	NSDateFormatter *dtsFormatter = [[[NSDateFormatter alloc] init]  autorelease];
	[dtsFormatter setDateFormat:@"%j"];
	
	//run the string through the formatter
	NSDate *testDate = [NSDate date];
	NSString *formattedDate = [dtsFormatter stringFromDate:testDate];
	NSLog(formattedDate);
 
Well, what is the proper formatter to get the day of the year in a 001-366 format? I've used the "%j" convention with other objective c classes and it has worked... 🙁
 
Actually, if you want 001-366, you'll want @"DDD".

Really? It seems to be working with one D...

By the way, when you get the day of the week using the same method, it returns 1-7 rather than 0-6 as was the case with the formatter I used in previous versions of my app. Interesting

EDIT: DDD also works, so what is the difference?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.