You are here: Re: All Monday's & Thursdays « All PHP « IT news, forums, messages
Re: All Monday's & Thursdays

Posted by -Lost on 06/30/06 04:13

"Stuart Colman" <news@N0$PAMcdfx.co.uk> wrote in message
news:44a44c0e$0$4889$fa0fcedb@news.zen.co.uk...

> There are a few dates missing from the list, such as Mon 5th, Thu 8th, Mon 19th and Thu
> 22.

I honestly do not know why his/her code does that. Then again, I could not read the code
very well. (I probably did not pay enough attention.)

> Any ideas how to get these values too?

Would this work for you?

<?php
$hour = 0;
$minutes = 0;
$seconds = 0;
$month = 6; // june
$day = 1;
$temp_day = $day;
$year = 2006;
$days = array();

$curr_timestamp = mktime($hour, $minutes, $seconds, $month, $day, $year);

while($month == date('m', $curr_timestamp)) // increment timestamp when done
{
$curr_timestamp = mktime($hour, $minutes, $seconds, $month, $temp_day++, $year);

if(date('D', $curr_timestamp) == 'Mon' || date('D', $curr_timestamp) == 'Thu')
{
$days[] = date('Y M D (d)', $curr_timestamp);
print date('Y M D (d)', $curr_timestamp) . '<br />';
}
}
?>

There you have an array available with all Mondays and Thursdays, and it prints them out
by default.

You could easily make this a function, but I never bother for illustration purposes. Hope
this helps.

-Lost

 

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

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