Working with Dates & Hours

Date & hours come in handy when you need to work for something like booking system or calendar or reminder application.

<code>

<?php

$daysInWeek = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
?>
<table class="table table-bordered">
<tr>
    <?php
    foreach($daysInWeek as $din){
        echo '<td>'.$din.'</td>';
    }
    ?>
</tr>

<?php
    
    echo '<a href="index.php?month=2&year=2016">Prev</a><br/>';
    $month = date('m');
    $year = date('Y');
    $totalDays = cal_days_in_month(CAL_GREGORIAN, $month, $year);
    $currentTimestamp = mktime(0, 0, 0, $month, 28, $year);
    $counter = 0;
    echo date('F', $currentTimestamp).' | '.$year.'<br/>';

   

    
    

    for($d=1; $d<=$totalDays; $d++, $counter++)
    {
        $time=mktime(0, 0, 0, $month, $d, $year);
        $firstDay = date('w', $time).' ';          
        
            if($d == 1 ) {
                
                for($j = 1; $j<$firstDay; $j++, $counter++){
                    echo "<td>&nbsp;</td>"; 
                }
                
            } 
            
            
            
            if( $counter%7 == 0 ){

                echo '</tr><tr>';
            }

            echo '<td id="tabledata" onmouseover="showHours('.$d.');">';
            echo $d;
            
            //echo '$100<br/>';
            //foreach($slots as $st){
            //   echo $st.'<br/>';
            //}
            echo '</td>';
            
    } // end of for loop


    echo "<tr/></table>";

?>

</code>



About me

I'm Subash Thapa (web developer, freelancer, designer).

Web development has been my passion from the day I started using computer. I can help you from the first stage of website i.e designing, programming(developing) till the last stage or deployment, including domain name registration and hosting.

I would love to get engaged in any type of website to design, develop or maintenance.