mercredi 27 août 2014

dateWithTimeIntervalSince1970 method return wrong date


Vote count:

0




the timezone will change ,when i put different seconds in dateWithTimeIntervalSince1970: method here is the code :



NSDateFormatter* dateFormat = [[[NSDateFormatter alloc] init] autorelease];
[dateFormat setDateFormat:format];
[dateFormat setTimeZone:[NSTimeZone localTimeZone]]; //Asia/shanghai +8:00
int64_t timestamp = 714880800 ;// 683258400
NSDate* date = [NSDate dateWithTimeIntervalSince1970:timestamp];
NSString *str = [dateFormat stringFromDate:date];


I make timestamp = 714880800 first time,and then 683258400,but the result is that:


enter image description here


enter image description here


so ,if there is something i missed?



asked 33 secs ago

Dean

93






dateWithTimeIntervalSince1970 method return wrong date

Aucun commentaire:

Enregistrer un commentaire