Reply to Re: Same day last year problem

Your name:

Reply:


Posted by NC on 02/16/06 06:40

rjfjohn...@hotmail.com wrote:
>
> Today is Thursday 16-Feb-06. The same thursday last year is 17-Feb-05.
> Because I am comparing daily sales between years, I need to know the
> date of the same weekdayname as last year, so that I am comparing
> Saturdays with Saturdays, Sundays with Sundays, etc

Essentially, you need to know the date that was 52 weeks before today:

$today = time();
$year_ago = $today - 52*7*24*60*60;
$today_date = date('Y-m-d', $today);
$year_ago_date = date('Y-m-d', $year_ago);

Now you can use $today_date and $year_ago_date in a query...

Cheers,
NC

[Back to original 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

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