search

Home  >  Q&A  >  body text

Algorithm - php judge restart every day?

Need to record the number of orders placed every day
Every day is from 1, 2, 3...8, 9, 10

// 今天结束时间戳
$end = mktime(0,0,0,date('m'),date('d') + 1,date('Y');
if(time() >=  $end){
    // 继续添加
}else{
    // 重新开始
}

这样算是不对的,因为
mktime(0,0,0,date('m'),date('d') + 1,date('Y');
永远都是第二天.

How to calculate it?

代言代言2709 days ago825

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-06-24 09:44:23

    I think. The conditions that the questioner wants to calculate cannot be solved simply by relying on built-in functions.
    No matter you get the end time of the day, the revelation time, or any other time, it will not work The database takes out the previous order record for comparison, but nothing can be seen.
    So it is recommended to save the order time when recording orders, and when there is a new order, take out the previous record for comparison. In this case, there are many implementation methods Well, it should go without saying.

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-24 09:44:23

    After reading it twice, I don’t understand what you are asking? Is there something wrong with my understanding?

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-24 09:44:23

    strtotime('tommorow');

    reply
    0
  • 欧阳克

    欧阳克2017-06-24 09:44:23

    It feels right, why is it wrong

    reply
    0
  • Cancelreply