You are here: Re: [PHP] script « PHP « IT news, forums, messages
Re: [PHP] script

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация