Date Time Php






$j = $j ? $j : date("Y",time());
$m = $m ? $m : date("n",time());
$d = $d ? $d : date("j",time());
$intDATE=(mktime(0,0,0,$m,$d,$j));
$upM=mktime(0,0,0,($m+1),1,$j);
$doM=mktime(0,0,0,($m-1),1,$j);
function get_mARRAY() {
global $intDATE;
global $d;
global $m;
global $j;
if (date("w",mktime(0,0,0,$m,1,$j))==2) { //if 1st of requested month is a monday -
start with first
$startDAY=mktime(0,0,0,$m,1,$j);
} else { //if not then we look for the last monday of
the previous month
$startDAY=mktime(0,0,0,$m,0-date("w",mktime(0,0,0,$m,1-1,$j)),$j);
}
for ($i=1;$i<=42;$i++) {
$marray[$i]=mktime(0,0,0,date("n",$startDAY),date("j",$startDAY)+$i,date
("Y",$startDAY));
}
return $marray;
}
$mARRAY=get_mARRAY();
?>















$countDAYS=1;
for ($w=1;$w<=6;$w++) {
echo '';
for ($d=1;$d<=7;$d++) {
echo '';
$countDAYS=++$countDAYS;
}
echo '';
}
?>

echo '';
echo '';
echo '
';
?>

face="Verdana" color="#000080">
echo date("F",$intDATE) . " " . date("Y",$intDATE);
?>



echo '';
echo '';
echo '
';
?>
?


M


T


W


T


F


S


S
';
if (((date("j",$mARRAY[$countDAYS])>7) & ($w==1)) | ((date
("j",$mARRAY[$countDAYS])<=14) & ($w>=5))) {
echo 'target="navframe" style="color:C0C0C0">';
echo date("j",$mARRAY[$countDAYS]);
echo '
';
} else {
if ($mARRAY[$countDAYS]==$intDATE) {
echo '';
}
echo 'target="navframe">';
echo date("j",$mARRAY[$countDAYS]);
echo '
';
if ($mARRAY[$countDAYS]==$intDATE) {
echo '
';
}
}
echo '