iphone - Convert NSString of a date to an NSDate -


this might silly question, can't seem find answer on here or in documentation.

i want convert nsstring such @"9/22/2010 3:45 pm" nsdate.

i know use nsdateformatter, problems

  1. the month 1 or 2 digits
  2. likewise, date 1 or 2 digits
  3. hours 1 or 2 digits
  4. what do am/pm?

nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"mm/dd/yyyy h:mm a"]; nsdate *date = [dateformat datefromstring:datestr]; [dateformat release]; 

there no problem in 2 digit day or 2 digit month.

this must you.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -