php - Display Datatime-local Datatype in HTL5 Table Without Trailing Text or Zeros -


i want display data sql table , datatype datetime(6) data size 6 bytes. when display data in html table input tag andtype text datetime format trailing zeros. want display datetime format without trailing zeroes.i present codes below.

codes on input form data collected.

<li>     <label for="date-time">access date , time</label>     <input name="date-time" type="datetime-local" id="date-time"/>  </li>

this code displaying data.

<?php  include('/templates/header.php');  $host = "localhost"; // host name   $username = "root"; // mysql username   $password = ""; // mysql password   $db_name = "datacentre"; // database name   $tbl_name = "data_centre_users"; // table name   $server_name = "localhost";    // create connection  $con = new mysqli($server_name, $username, $password, $db_name, 3306);  if($con->connect_error){     die("connection failed: ".$con->connect_error);  }    // check connection  if($con->connect_error){   die("connection failed: ".$conn->connect_error);  }    $sql = "select * $tbl_name";  $result = $con->query($sql);  ?>    <section id="sidebar">    </section>    <section id="content">    <div id="scroll-table">  <table >  <caption>             list data mysql              </caption>              <tr>                  <th class="center"><strong>id</strong></th>                  <th class="center"><strong>firstname</strong></th>                  <th class="center"><strong>lastname</strong></th>                  <th class="center"><strong>request</strong></th>                  <th class="center"><strong>purpose</strong></th>                  <th class="center"><strong>description</strong></th>                  <th class="center"><strong>booking time</strong></th>                  <th class="center"><strong>access time</strong></th>                  <th class="center"><strong>exit time</strong></th>                  <th class="center"><strong>approved</strong></th>                  <th class="center"><strong>approved by</strong></th>                  <th class="center"><strong>update</strong></th>                  <th class="center"><strong>delete</strong></th>              </tr>              <?php              if($result->num_rows > 0){                  // output data of each row                  while($rows = $result->fetch_assoc()){ ?>                      <tr>                          <td class="center"><?php echo $rows['id']; ?></td>                          <td class="center"><?php echo $rows['fisrt_name']; ?></td>                          <td class="center"><?php echo $rows['last_name']; ?></td>                          <td class="center"><?php echo $rows['request']; ?></td>                          <td class="center"><?php echo $rows['purpose']; ?></td>                          <td class="center"><?php echo $rows['description']; ?></td>                          <td class="center"><?php echo $rows['booking_time']; ?></td>                          <td class="center"><?php echo $rows['access_time']; ?></td>                          <td class="center"><?php echo $rows['exit_time']; ?></td>                          <td class="center"><?php echo $rows['approved']; ?></td>                          <td class="center"><?php echo $rows['approved_by']; ?></td>                          <td class="center" ><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td>                          <td class="center" ><a href="delete.php?id=<?php echo $rows['id']; ?>">delete</a></td>                      </tr>                                                <?php                  }              }              ?>   </table>  </div>  </section>      <aside></aside>    <?php  $con->close();    include('/templates/footer.php');  ?>

this web page.

enter image description here

$timestamp = strtotime($rows['booking_time']); echo date('y-m-d h:i:s',$timestamp); 

should format date


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

php - How do you embed a video into a custom theme on WordPress? -