Help removing weekend from calendar script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rippie
Forum Commoner
Posts: 76
Joined: Sun Jan 10, 2010 11:32 am
Location: Nottingham

Help removing weekend from calendar script

Post by Rippie »

I could really do with some help in removing Saturday and Sundays from a weekend script. Basically a friend gave me some code that would output monday to sunday, but i dont need saturday and sunday, but i cant find a way either not to show them.

The script basically show me 2 weeks ahead from the day im on. so right now it would show me from Tuesday to Tuesday in 2 weeks.

code i have:

Code: Select all

#create table headers
function createTableHeaders($value, $value1, $value2) {
  echo "<tr>";
  $dV = $value2;
  for ($i = $value; $i < $value1; $i++) {
    echo "<th>".date('D dS M', time()+$dV)."</th>";
    $dV = $dV + 86400;
  }
  echo "</tr>";
}
Above code print out monday tuesday wednesday thursday friday saturday sunday.

Can anyone help me to to get rid of saturday and sunday ??

Rippie
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Help removing weekend from calendar script

Post by AbraCadaver »

Depends upon how you call the function. What are $value, $value1, $value2?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Rippie
Forum Commoner
Posts: 76
Joined: Sun Jan 10, 2010 11:32 am
Location: Nottingham

Re: Help removing weekend from calendar script

Post by Rippie »

Honestly i am not completely sure. :( but i can try read the code and figure out. But what i want to achieve is a script that shows something like this:

Current week:
Monday - Tuesday - Wednesday - Thursday - Friday

Next week:
Monday - Tuesday - Wednesday - Thursday - Friday

the script is going to be used in a "show availability for next 2 weeks" script, and of course it has to be dynamic so i dont have to update the weeks myself.

Rippie
Post Reply