title: Constructing an NSDate from today's date and a string with the time
body: <p>If I have a string representing a time, say "10:45 am", and do the following to parse the string:</p>
  
  <pre><code>NSDateFormatter *dateFormat;
  dateFormat = [[NSDateFormatter alloc] init];
  [dateFormat setDateFormat:@"h:mm a"];
  NSLog(@"%@", [dateFormat dateFromString:@"10:45 AM"]);
  </code></pre>
  
  <p>I would get this logged:</p>
  
  <blockquote>
    <p>2013-09-09 17:52:30.416 TimeTest[49491:a0b] 2000-01-01 15:45:00 +0000</p>
  </blockquote>
  
  <p>How can I create an <code>NSDate</code> for the current day at the given time? I tried this</p>
  
  <pre><code>NSDate *date = [NSDate date];
  NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
  [formatter setDateFormat:@"h:mm a"];
  NSDate *time = [formatter dateFromString:@"10:45 AM"];
  NSDateComponents *timeComponents = [[NSCalendar currentCalendar] components:(NSHourCalendarUnit | NSMinuteCalendarUnit ) fromDate:time];
  NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:date];
  NSDateComponents *newComponents = [[NSDateComponents alloc]init];
  newComponents.timeZone = [NSTimeZone systemTimeZone];
  [newComponents setDay:[dateComponents year]];
  [newComponents setMonth:[dateComponents month]];
  [newComponents setYear:[dateComponents year]];
  [newComponents setHour:[timeComponents hour]];
  [newComponents setMinute:[timeComponents minute]];
  NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
  NSDate *combinedDate = [gregorianCalendar dateFromComponents:newComponents];
  NSLog(@"%@", combinedDate);
  </code></pre>
  
  <p>with the result</p>
  
  <blockquote>
    <p>2013-09-09 19:57:14.506 TimeTest[49712:a0b] 2019-03-06 15:45:00 +0000</p>
  </blockquote>
  
  <p>How should I go about this?</p>