Posted By

sag333ar on 12/16/10


Tagged

xcode Objective-c iphone nsstring NSDate


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

sag333ar
synced
bammi
cnathan


NSString to NSDate


 / Published in: Objective C
 

  1. NSDateFormatter *inFormat = [[NSDateFormatter alloc] init];
  2. [inFormat setDateFormat:@"yyyy-mm-dd HH:mm:ss"];
  3. NSString *str=@"1998-11-25 15:20:22";
  4. NSDate *parsed = [inFormat dateFromString:str];
  5. NSLog(@"%@",str);

Report this snippet  

You need to login to post a comment.