When the output time is in the format
Mon SEP 28 22:25:56 +0800 2015 If you want to display%@ seconds/minute/time before you need to format it
NSDateFormatter * formart=[[nsdateformatter alloc]init];
This sentence is for the simulator output is normal, and on the real machine when the output is empty
Nslocale * Local=[[nslocale alloc]initwithlocaleidentifier:@ "en_US"];
[Formart setlocale:local];
[Formart Setdateformat: @ "EEE MMM d HH:mm:ss zzz yyyy"];
nsdate * Date=[formart Datefromstring:li. Time];
Double inter=fabs([date Timeintervalsincenow]);
if (Inter < )
{
Cell. timelable. Text=[nsstring stringwithformat:@ "%.0lf seconds ago ", Inter];
}
Else if (Inter >&& Inter <60*)
{
Cell. timelable. Text=[nsstring stringwithformat:@ "%.0lf minutes ago ", inter/60 ];
}
Else if (Inter >60*&& Inter <60*60*)
{
Cell. timelable. Text=[nsstring stringwithformat:@ " today %@", Date];
}
Else
{
double i= inter/(24*60*);
Cell. timelable. Text=[nsstring stringwithformat:@ "%.0lf days ago ", I];
}
Conversion of time format