Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In NSDateComponents, how do you know if it's AM or PM?

When I use NSDateComponents, how do I know I'm setting a time as Am or Pm? Or is it 24-hour format? Here's the code:

NSDate *morningEnd = [NSDate date];
NSDateComponents *components1 = [gregorian components:NSUIntegerMax fromDate:morningEnd];
[components1 setHour:11];
[components1 setMinute:59];

How do I know if I'm setting it as 11:59 AM or 11:59 PM?

like image 910
SunnyChopper Avatar asked Oct 24 '12 04:10

SunnyChopper


1 Answers

The hour is defined out of 24 hours. 0 - 11 will be AM, 12 - 23 will be PM.

Edit:

Corrected my range to be 0 - 23 as per the comments below. Thanks guys for correcting me.

like image 85
drewag Avatar answered Sep 29 '22 14:09

drewag