Algorithm - php judge restart every day?
代言
代言 2017-06-24 09:42:23
0
4
774

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?

代言
代言

reply all(4)
Peter_Zhu

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.

女神的闺蜜爱上我

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

曾经蜡笔没有小新

strtotime('tommorow');

学霸

It feels right, why is it wrong

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!