开发者

Number of seconds until every 20 minutes

开发者 https://www.devze.com 2023-03-05 11:17 出处:网络
For a game I\'m making, each turn is at :00, :20, and :4开发者_Python百科0 past the hour. I am trying to create a countdown that will display the number of minutes (and eventually seconds) to the next

For a game I'm making, each turn is at :00, :20, and :4开发者_Python百科0 past the hour. I am trying to create a countdown that will display the number of minutes (and eventually seconds) to the next turn.

My current approach is to store the time of the next turn in a database, then doing

$time = time() - $time_to_turn

where time_to_turn is the database entry of the next turn time.

Is there a way to not use the database?


Try $minutesRemaining = 20 - date('i') % 20; or $secondsRemaining = 1200 - date('s') % 1200

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号