date - How to convert iPhone time into seconds? -
i have problem. before explain, let me few things out of way. have progress bar has 604,800 states become full. how many seconds in week, , every second passes, want progress bar change one. me?
okay, here problem. since homemade progress bar in seconds, need convert iphone time seconds , display progress bar accordingly. reset @ midnight sunday (changeable day user depending on day last day of week, no difference). example, if 5 o'clock in morning on monday (18,000 seconds after midnight sunday) progress bar on it's 18,000th state.
how can accomplish this? believe need first convert [nsdate date]; seconds , add each second passes int resets every week.
this confusing, think explained well. can me out?
thank you!
use - (nstimeinterval)timeintervalsincedate:(nsdate *)anotherdate
. in case, like:
nsdate *previoussunday = [self previoussunday]; // still need define method. nsdate *now = [nsdate date]; nstimeinterval secondsfromsunday = [now timeintervalsincedate: previoussunday];
for how implement method previoussunday
, check out: dynamically create date previous sunday @ 12:00 am.
Comments
Post a Comment