天天看點

ios擷取系統目前日期,一定日期格式的代碼

nsdate *  senddate=[nsdate date];  

nsdateformatter  *dateformatter=[[nsdateformatter alloc] init];  

[dateformatter setdateformat:@"yyyymmdd"];  

nsstring *  locationstring=[dateformatter stringfromdate:senddate];    

nslog(@"locationstring:%@",locationstring);

 [dateformatter release]; 

格式:yyyy-mm-dd hh:mm:ss

繼續閱讀