Get the time data from database

i get time from database that can modify but it reset the time to 00—00—00

     <?php
        $months=range(1,12);
        $years=range(2010,1900);
        $year=substr($row['5'],0,4);
        $month=substr($row['5'],5,2);
        echo'<select name="year">';
        foreach($years as $key=>$value){
            if($key==$year)
            {
            echo '<option selected=selected value="' .$key . '">' . $value . '</option>';
            }
            else{
                echo '<option value="' .$key . '">' . $value . '</option>';                
            }
        }
        echo'</select>';
        echo'<select name="month">';
        foreach($months as $key=>$value){
            
          if($key==$month)
            {
            echo '<option selected=selected value="' .$key . '">' . $value . '</option>';
            }
            else{
                echo '<option value="' .$key . '">' . $value . '</option>';                
            }
        }
        echo'</select>';
        echo $row['5'];
      
        ?>

so i do not know how to do

So far you are only showing us how you prepare a form to display year and month.

Those are date components.

You say time is 00-00-00 but I am not sure what that code has to do with the time.

Can you explain more about where the date/time is being put into the database, if getting it out gets zeros.

If I understand correctly if you were to put a date only into a date/time (timestamp) field it will set the time to 0s

Example: 2010-12-07 00:00:00

Agreed with Cups. Additionally if you want us to help you then you give the field type in the database table and the PHP script that saves the date to the database.

see the details fromhttp://www.sitepoint.com/forums/showthread.php?t=715955