javascript - How to determine continuous check-ins based on the last check-in time
ringa_lee2017-06-05 11:10:16
0
4
872
Try current time - last check-in time > 60×60×24. This method always breaks the signature. So if the last check-in was at 0:00 on the 1st, today is at 23:59 on the 2nd
When calculating, why not just use the 0-point timestamp for calculation, (strtotime(date('Y-m-d',$time1))-strtotime(date('Y-m-d',$time2)))/(3600 *twenty four). There is no need to do this. Each person has one record, user ID, last check-in date, and consecutive check-in dates. Determine whether there are several days between today and the last check-in date. If it is the next day, the continuous check-in date +1. If there are several days apart, Day, it will directly become 1.
You definitely cannot use the time seconds to confirm. For example, if your previous time was 2017-5-30, I can get the second day's time 20170531 through the date() function. Then get and set the day's time format Ymd. Determine whether two are equal
When calculating, why not just use the 0-point timestamp for calculation, (strtotime(date('Y-m-d',$time1))-strtotime(date('Y-m-d',$time2)))/(3600 *twenty four).
There is no need to do this. Each person has one record, user ID, last check-in date, and consecutive check-in dates. Determine whether there are several days between today and the last check-in date. If it is the next day, the continuous check-in date +1. If there are several days apart, Day, it will directly become 1.
How about comparing the dates directly...
Although when I sign in now, it is considered a successful sign-in 18-32 hours after the last time. .
You definitely cannot use the time seconds to confirm. For example, if your previous time was 2017-5-30, I can get the second day's time 20170531 through the date() function. Then get and set the day's time format Ymd. Determine whether two are equal