dtlc84438 2012-05-21 19:45
浏览 30

每周添加一个值

I wanted to see if I can change the value number of several texts weekly without the use of a database. Just with the use of PHP

For instance, on the website you see the following

  • Game 265
  • Game 264
  • Game 263
  • Game 262

1 Week later I want the numbers to add 1 and change to

  • Game 266
  • Game 265
  • Game 264
  • Game 263
  • 写回答

1条回答 默认 最新

  • dosgy00204 2012-05-21 19:49
    关注

    Perhaps you could do this by counting the number of weeks between the current date and some arbitrary date in the past. So, since today is 5/21/2012, if you counted the weeks since 5/7/2012 you would get 2. If you wanted to start the counting at 266 you could do: $weeksSinceDate + 264

    ::UPDATE:: In response to your question, here is some code you could use:

    $counterStartNum = 266;
    $date1 = new DateTime("2012-05-21");
    $date2 = new DateTime();
    $interval = $date1->diff($date2);
    $weeksSinceDate = $interval->d / 7;
    $currentCounter = $counterStartNum + $weeksSinceDate;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?