Take date information from ipad

65 Views Asked by At

We need to take the actual date from the IPad and save it in a variable. We have searched NSDateComponents and NSDate, but we havent found anything. For example if today is 25 of october, we would like to have a int with the value of 25 and another with 10 (october).

We will appreciate any help. Thank you!!

1

There are 1 best solutions below

0
On BEST ANSWER

What did you try?

Did you at least read the Date and Time Programming Guide about the subject which explains everything?

The Listing 5 in the documentation gives you pretty much the answer directly

NSDateComponents *comps = [[NSCalendar currentCalendar] components:(NSDayCalendarUnit | NSMonthCalendarUnit) fromDate:[NSDate date]];
NSInteger day = [comps day];
NSInteger month = [comps month];