Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
とにかく、現在の時刻が2つの時刻の間にあるかどうかを確認できますか?
現在の時刻 = 午前 12:00 時刻 A: 午前 8:00 時刻 B: 午後 3:00
これは true を返しますが、そうではありません: 現在の時刻: 1:00 PM A = 1:00 AM B = 2:00 AM
次の行に沿って何かを行うことができます。
NSDate *timeA, *timeB; // Whatever and however you want to set these; NSDate *now = [NSDate date]; If([now compare:timeA] == NSOrderedDescending && [now compare:timeB] == NSOrderedAscending) // then now is between timeA and Time B