I am really trying to convert this timestamp into a nice formatted date string.
Here's the timestamp: "1316625985"
And here is the function I made:
-(NSString*)timestamp2date:(NSString*)timestamp{
NSString * timeStampString =timestamp;
NSTimeInterval _interval=[timeStampString doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init];
[_formatter setDateFormat:@"dd/MM/yy"];
return [_formatter stringFromDate:date];
}
The problem is that it keeps return dates in 1972! (31/7/72) This is wrong, as it is a September date ...
Can anyone suggest any solution?
Thank you very much in advance,
source
share