nickthedude nickthedude - 7 months ago 13
iOS Question

iPhone OS: How do I create an NSDate for a specific date?

Seems like a simple thing but I can't seem to find a way to do it.

It would be great to see a couple different methods.


@Chuck's answer is correct, and lead me to the following code. Thought I'd share:

NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:10];
[comps setMonth:10];
[comps setYear:2010];
self.timestamp = [[NSCalendar currentCalendar] dateFromComponents:comps];