I'm just learning Objective-C and Xcode and trying to make some simple apps.
I need to get today's day and month as ant int.
Example:
Todays day: 29/12/2013
(int) TodaysDay = 29;
(int) TodaysMonth = 1200;
(1 - 100, 2 - 200, 3 - 300...)
(int) TodaysValue = TodaysDay + TodaysMonth;
(in ex. 1229)
switch(TodaysValue)
case 1229:
do something.
I tried using this:
NSDate *today = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"dd/MM"];
NSString *dateString = [dateFormat stringFromDate:today];
Thank you for your help!
This works pretty well!
CFGregorianDate currentDate = CFAbsoluteTimeGetGregorianDate(CFAbsoluteTimeGetCurrent(), CFTimeZoneCopySystem());
TodaysDay = currentDate.day;
TodaysMonth = currentDate.month;
TodaysValue = TodaysDay + (TodaysMonth * 100);