0

I want to compare time blocks to see if they over lap. For example, 10am - 12pm and 11am - 1pm. I was wondering if i need to create a custom class for that or if obj-c has a class with methods that can help me do that. I looked at NSDateComponents, but the problem is that i can only set one hour, not the interval. Incase i need to make a custom class, is there a way to input the actual time (10:00) or would i need to use integers and such.

Thanks in advance.

Edany416
  • 49
  • 6
  • An NSDate represents a single point in time. NSTimeInterval is used to represent an interval of time. What you want is something a little more specific. – CrimsonChris Jul 29 '14 at 21:33
  • 1
    It's unclear whether you want a block of time from 10 to 12 today, or every day. If just today, use NSDate values for start and end. If every day, you need to be a bit more creative -- eg, use an integer with the number of minutes since midnight to represent a time. And there are a dozen different ways to convert between NSDate values and various numeric components. – Hot Licks Jul 29 '14 at 21:33
  • Note that *any* sort of interval will require two values (at least) -- you need start and end as separate values. – Hot Licks Jul 29 '14 at 21:34
  • @HotLicks, sorry i meant today but thanks for the answer, ill try that. – Edany416 Jul 29 '14 at 21:39

0 Answers0