Posted by Philip Hallstrom on 04/21/05 06:41
> I'd like to get my code to calculate the time between the current date (when
> the page is loaded by the visitor) and the very next Tuesday at 11pm. I
> suspect I can do this with date("w") but I can't quite figure out how to make
> Tuesday the beginning or end of the week in order to accomplish this...
>
> maybe I'm going about this the wrong way.
>
> Again, any pointers or assistance appreciated.
Hmm... well, using date("w") will tell you what day of the week it is, and
you know that 0=sunday and 2=tuesday.
use that and some logic to compute the number of days between today and
the next tuesday.
Then figure out how many seconds have elapsed for today and
use that in conjunction with the number of days in between and the number
of seconds to get to 11pm (23*60*60).
Then substract the two... and pass that to date in the format you want.
Or something like that :)
-philip
[Back to original message]
|