2

how do i format Aug 8, 2011 11:40 into nsdate using nsdatepicker?Im trying to use

[dateFormatter setDateFormat:@" MMM d, YYYY HH:mm"];

but it doesnt work

1 Answers1

0

Try this

iPhone format strings are in Unicode format. Behind the link is a table explaining what all the letters above mean so you can build your own

 NSString *dateString = @"Aug 8, 2011 11:40";
 NSDateFormatter *format = [[NSDateFormatter alloc] init];
 [format setDateFormat:@"MMM dd, yyyy hh:mm"];
 NSDate *date = [format dateFromString:dateString];
 NSLog(@"date: |%@|", date);
Ravindhiran
  • 5,304
  • 9
  • 50
  • 82