The number of seconds from now () to midnight on Sunday

In PHP, how do I get the number of seconds from now() to next Sunday at midnight?

I do not want a decision on a specific date, but only by next Sunday.

+2
php time
Jan 14 2018-11-14T00:
source share
5 answers
 $seconds = strtotime('next Sunday') - time(); 
+17
Jan 14 2018-11-14T00:
source share

you can use

 print strtotime('next Sunday') - time(); 
+7
Jan 14 2018-11-14T00:
source share

Try the following:

 function secs_until() { $now = time(); $next = strtotime("next Sunday midnight"); return $next - $now; } 
+5
Jan 14 2018-11-11T00:
source share

It's simple:

 strtotime('next Sunday') - time() 
+3
Jan 14 2018-11-14T00:
source share
 $seconds = mktime(0,0,0, date("n"), date("j") + (7 - date("N")), date("Y")) - time(); 

This line will give you the difference in seconds from today until Sunday morning at 12:00. You can configure the first 3 arguments in mktime () to give you a variable time of day (e.g. 8:45 a.m.).

+2
Jan 14 2018-11-14T00:
source share



All Articles