开发者

Number of seconds until every 20 minutes

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜