How to to take time as input OS X

Concate all UITextField data i.e

NSString * strTime = [NSString stringWithFormat:@"%@:%@ %@",txtHours.text, txtMin.text, txtAMPM.text];

NSDateFormatter *dateFormatter= [[NSDateFormatter alloc]init];
[dateFormatter1 setDateFormat:@"HH:mm a"];
NSDate *startD = [dateFormatter1 dateFromString:strTime]; // this code is used for converting string into nsdate

Now, you can compare current system time with this above NSDate.

Hope this will help you 🙂

Leave a Comment