title: iPhone: Getting date from date picker
body: <p>I wrote an app that allows users to enter in a date on a date picker, and the app will alert the user 36 hours before that date arrives. My issue is in the <code>dateFromString:</code>. I'm not sure what to put in there. Here is the code:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  UILocalNotification *localNotif = [[UILocalNotification alloc] init];
  
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  [dateFormatter setDateFormat:@"mm'/'dd'/'yyyy"];
  NSDate *eventDate=[dateFormatter dateFromString: ]; 
  
  localNotif.fireDate = [eventDate dateByAddingTimeInterval:-13*60*60];
  localNotif.timeZone = [NSTimeZone defaultTimeZone];
  
  
  localNotif.alertBody = @"Event tommorow!";
  
  localNotif.alertAction = nil;
  
  localNotif.soundName = UILocalNotificationDefaultSoundName;
  localNotif.applicationIconBadgeNumber = 0;
  [[UIApplication sharedApplication]presentLocalNotificationNow:localNotif];    
  
  return YES;
  </code></pre>
  
  <p>}</p>
  
  <p>Any help is much appreciated, thank you!</p>
  
  <p>Edit: Here is some additional code that I'm using to save the date they entered on the date picker if that helps:</p>
  
  <pre><code>- (void)viewDidLoad {
      NSDate *storedDate = [[NSUserDefaults standardUserDefaults] objectForKey:@"DatePickerViewController.selectedDate"];
  
      [self.datePicker setDate:storedDate animated:NO];
  }
  </code></pre>
  
  <p>And this is the method that saves the data:</p>
  
  <pre><code>- (IBAction)dateChanged:(id)sender {
  
  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  
  NSDate *selectedDate = [self.datePicker date];
  
  [defaults setObject:selectedDate forKey:@"DatePickerViewController.selectedDate"];}
  </code></pre>