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

JoshAK

macrumors newbie
Original poster
Aug 12, 2008
19
0
Hi,
I'm working on an app that requires the current day and month in the
following format: 108 the number 1 representing the day of the month
and the 08 representing the month. If I were to write this in an
application that would run on a Mac I would use
descriptionWithCalendarFormat:mad:"%e%m" timeZone:nil locale:nil. That
works fine in the iPhone simulator, but when I load the app into the
phone it gives me warnings. Can anyone please help me use some other
date format. Thanks,
Josh
 

JoshAK

macrumors newbie
Original poster
Aug 12, 2008
19
0
More Help Please

I'm new to cocoa can you give me an example of how I would get that info using components:fromDate: method I'm still not sure how I can do this.

Thanks,

Josh
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Code:
NSCalendar *cal = [NSCalendar currentCalendar];
NSDateComponents *comps = [cal components:kCFCalendarUnitMonth|kCFCalendarUnitDay
        fromDate:[NSDate date]];
NSLog(@"day: %d; month: %d", [comps day], [comps month]);
 

JoshAK

macrumors newbie
Original poster
Aug 12, 2008
19
0
Thank You!!!

Thank you so much. I've been reading and reading trying to find the answer to that question. You've been a great help!!!:)
 

andy.iphone

macrumors newbie
Sep 2, 2008
6
0
Calender view

Pls help me -----where can i got code for calender....:)
Complete code required for NSCalender.....pls help

kainjow's code helpful.But I can't implement it.

As I'm newbe.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.