Thanks for watching my tutorial. This is the further documentation on the video. I tried as best as i could to explain what the formulea does. Explaining this was actually one of the hardest things i've done so far in a video. The calculation needs the following things: Future timestamp Current timestamp You need to calculate the difference to make a furter calculation. This is needed because you need to know how many seconds you still got left before the current timestamp reaches the future timestamp. Now the code for minutes: floor(($difference - ($hours*3600)/60)) This code is for calculating the minutes relative to how many hours we still got left. You basicly take the amount of full hours that you KNOW you still gotta do, convert it back to seconds and subtract that from the difference divided by 60 to convert it to minutes. This calculation is relative to the amount of hours you still got left. Now the code for seconds: floor(($difference - ($minutes*60)) Now we are calculating the amount of seconds relative to the amount of minutes we still got left. This is also relative to the amount of hours due to using the same timestamp. You just do the same trick really. Take the full KNOWN minutes that we KNOW we still gotta wait and turn those into seconds to subtract them from the difference, we are left with the amount of seconds relative to the last minute in line. Hope this helps foks!
No comments:
Post a Comment