iphone - Getting Seconds interval between NSDate, but get always zero seconds -


i want diff seconds between nsdate. used [nsdate timeintervalsincedate] methods, returns zero. below code.

nslog(@"sent date : %@", message.sentdate); nslog(@"prev: %@", _previousshownsentdate); nslog(@"%d", [message.sentdate timeintervalsincedate:_previousshownsentdate]); 

in here, message.sentdate, _repviousshownsentdate nsdate object.

but in logs, difference seconds zero.

[1363:907] sent date : 2013-05-16 01:36:22 +0000 [1363:907] prev: 2013-05-16 01:36:17 +0000 [1363:907] 0 [1363:907] sent date : 2013-05-16 01:36:25 +0000 [1363:907] prev: 2013-05-16 01:36:17 +0000 [1363:907] 0 

the third log line must 5 (01:36:22 , 01:36:17). zero.

i don't understand mistake.

because "%d" integer , value returned "timeintervalsincedate:" double (nstimeinterval).

use "%4.2f" in third "nslog" line.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -