I'm either a bit overwhelmed by the complexity of NSDate or I simply don't understand the concept of it :)
The only thing I want to do is to create an NSDate Instance representing today's date and a fixed time of 20.00h respectively 8pm.
This can't be as difficult as creating an instance holding the current time and afterwards either subtracting oder adding the neccessary difference to 8pm, can it?
Thanks for your help...
the ultranoob
Use NSCalendar:
NSCalendar* myCalendar = [NSCalendar currentCalendar];
NSDateComponents* components = [myCalendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit
fromDate:[NSDate date]];
[components setHour: 20];
[components setMinute: 0];
[components setSecond: 0];
NSDate *myDate = [myCalendar dateFromComponents:components];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With