I've got an application that requires the time until an event (in seconds) to display a countdown timer. The countdown timer should be counting down 20 minutes at a time. However, I need to use php to find the seconds to the next third of an hour (12:00, 12:20, 12:40, etc) and I've got no idea where to go with the logic on this.
Anyone have suggestions?
echo $remaining = 15-(date('i', time()) % 15);
$remaining
is the remainder of the number of minutes passed the hour divided by 15. Then as you want to see how many until the next 15, 15-x is your answer.
Obviously change 15 to 20 if you want thirds rather than quarters of an hour...