I can find how to get if a date is between a range, but I cant seem how to create a date at a specific time.
What would be the simplest way to see if [NSDate date] is be
Noon is at 12:00 PM. Afternoon is from 12:01 PM to around 5:00 PM. Evening is from 5:01 PM to 8 PM, or around sunset. Night is from sunset to sunrise, so from 8:01 PM until 5:59 AM.
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitHour fromDate:[NSDate date]];
[components setTimeZone:[NSTimeZone localTimeZone]];
NSInteger hour = [components hour];
if(hour >= 6 && hour < 12)
NSLog(@"Good morning!");
else if(hour >= 12 && hour < 17)
NSLog(@"Good afternoon!");
else if(hour >= 17 && hour < 20)
NSLog(@"Good evening!");
else if((hour >= 20) || (hour >= 0 && hour < 6))
NSLog(@"Good night!");