Please visit our sponsor
UNKNOWN //************************************** // Name: Week Days // Description:With these code you may retrieve the week days between two given dates. // By: Pedro Gonįalves // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //This code is copyrighted and has limited warranties. //Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.751/lngWId.8/qx/vb/scripts/ShowCode.htm //for details. //************************************** <? $fldmes = 5; $flddia = 13; $fldano = 2002; $fldmes1 = 7; $flddia1 = 13; $fldano1 = 2002; if($fldmes==$fldmes1) { if($fldmes==1) { $mes = "Jan"; $dias = 31; } if($fldmes==2) { $mes = "Feb"; $dias = 28; } if($fldmes==3) { $mes = "Mar"; $dias = 31; } if($fldmes==4) { $mes = "Apr"; $dias = 30; } if($fldmes==5) { $mes = "May"; $dias = 31; } if($fldmes==6) { $mes = "Jun"; $dias = 30; } if($fldmes==7) { $mes = "Jul"; $dias = 31; } if($fldmes==8) { $mes = "Aug"; $dias = 31; } if($fldmes==9) { $mes = "Sep"; $dias = 30; } if($fldmes==10) { $mes = "Oct"; $dias = 31; } if($fldmes==11) { $mes = "Nov"; $dias = 30; } if($fldmes==12) { $mes = "Dec"; $dias = 31; } for($flddia; $flddia <= $flddia1; $flddia++) { /* Pulls the numeric value for the day of the week */ $data = strtotime("$flddia $mes $fldano"); $data = unixtojd ($data); $dow = date($data, "w"); $dow = jddayofweek($dow); //Retorna o dia da semana /* 0 -> Sunday | 1 -&gt; Monday | 2 -&gt; Tuesday | 3 -&gt; Wednesday | 4 -&gt; Thursday | 5 -&gt; Friday | 6 -&gt; Saturday */ if($dow!=0 && $dow!=6) { print "$flddia $mes $ano<br>"; } } } else { //Męs inicial é diferente do męs final for($fldmes_act=$fldmes; $fldmes_act&lt;=$fldmes1; $fldmes_act++) { if($fldmes_act==1) { $mes = "Jan"; $dias = 31; } if($fldmes_act==2) { $mes = "Feb"; $dias = 28; } if($fldmes_act==3) { $mes = "Mar"; $dias = 31; } if($fldmes_act==4) { $mes = "Apr"; $dias = 30; } if($fldmes_act==5) { $mes = "May"; $dias = 31; } if($fldmes_act==6) { $mes = "Jun"; $dias = 30; } if($fldmes_act==7) { $mes = "Jul"; $dias = 31; } if($fldmes_act==8) { $mes = "Aug"; $dias = 31; } if($fldmes_act==9) { $mes = "Sep"; $dias = 30; } if($fldmes_act==10) { $mes = "Oct"; $dias = 31; } if($fldmes_act==11) { $mes = "Nov"; $dias = 30; } if($fldmes_act==12) { $mes = "Dec"; $dias = 31; } if($fldmes_act==$fldmes1) { for($i=1; $i&lt;=$flddia1; $i++) { /* Pulls the numeric value for the day of the week */ $data = strtotime("$i $mes $fldano"); $data = unixtojd ($data); $dow = date($data, "w"); $dow = jddayofweek($dow); //Retorna o dia da semana /* 0 -&gt; Sunday | 1 -&gt; Monday | 2 -&gt; Tuesday | 3 -&gt; Wednesday | 4 -&gt; Thursday | 5 -&gt; Friday | 6 -&gt; Saturday */ if($dow!=0 && $dow!=6) { print "$i $mes $ano<br>"; } } } elseif($fldmes==$fldmes_act) { for($flddia; $flddia&lt;=$dias; $flddia++) { /* Pulls the numeric value for the day of the week */ $data = strtotime("$flddia $mes $fldano"); $data = unixtojd ($data); $dow = date($data, "w"); $dow = jddayofweek($dow); /* 0 -&gt; Sunday | 1 -&gt; Monday | 2 -&gt; Tuesday | 3 -&gt; Wednesday | 4 -&gt; Thursday | 5 -&gt; Friday | 6 -&gt; Saturday */ if($dow!=0 && $dow!=6) { print "$flddia $mes $ano<br>"; } } } else { for($i=1; $i&lt;=$dias; $i++) { /* Pulls the numeric value for the day of the week */ $data = strtotime("$i $mes $fldano"); $data = unixtojd ($data); $dow = date($data, "w"); $dow = jddayofweek($dow); /* 0 -&gt; Sunday | 1 -&gt; Monday | 2 -&gt; Tuesday | 3 -&gt; Wednesday | 4 -&gt; Thursday | 5 -&gt; Friday | 6 -&gt; Saturday */ if($dow!=0 && $dow!=6) { print "$i $mes $ano<br>"; } } } } //Ciclo FOR dos meses } ?&gt;