timestamp - Xcode time difference in minutes fails -


quick question used following code retrieve difference between 2 timestamps. minutes given me in 0.5 hrs. how minutes (nsinteger format)?

nsdateformatter* dateformatter = [[[nsdateformatter alloc] init] autorelease]; [dateformatter setlocale:[[[nslocale alloc] initwithlocaleidentifier:@"en_us_posix"] autorelease]]; [dateformatter setdateformat:@"mm:ss"]; nsdate* firstdate = [dateformatter datefromstring:@"06:00"]; nsdate* seconddate = [dateformatter datefromstring:@"17:30"]; nstimeinterval timedifference = [seconddate timeintervalsincedate:firstdate]; 

i'm using nsinteger full hours, can't figure out minutes... must late @ night me :-/

    nsinteger hoursbetweendates = timedifference / 60; nsinteger minutesbetweendates = ??;  nslog(@"raw: %f", timedifference); nslog(@"hours: %i", hoursbetweendates); nslog(@"minutes: %i", minutesbetweendates); 

thanks guys! :-d

the nstimeinterval in seconds. minutes diff/60.0 , hours diff/3600.0.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -