Posted By

BenClayton on 01/20/10


Tagged

time now iphone NSDate


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Format the current time as an NSString


 / Published in: Objective C
 

  1. NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
  2. [dateFormat setDateFormat:@"HH:mm:ss"];
  3.  
  4. NSDate *now = [[NSDate alloc] init];
  5.  
  6. NSString* timeString = [dateFormat stringFromDate:now];
  7. [dateFormat release];
  8. [now release];

Report this snippet  

You need to login to post a comment.