Converting same date on my database and html

good day! i am a newbie in php and i have something to ask. I have a database fieldname date_reserved which is the date format is ex. June-12-2015. My problem is I can't convert my html code on the same format like whats inside my database. when i tried to echo them the result is 2015-01-06.

Here is my html code.

<?php if(isset($_GET['cancel_button'])) { $REuntil = date_create(strip_tags($_GET['until'])); $REfrom = date_create(strip_tags($_GET['from'])); $until = date_format($REuntil, "F-d-Y"); $from = date_format($REfrom,"F-d-Y"); ?> <table class="table table-striped"> <tr> <td><strong>Cottage Name</strong></td> <td><strong>Customer Name</strong></td> <td><strong>Date Reserved</strong></td> <td><strong>Reservation Type</strong></td> <td><strong>Total Payment</strong></td> </tr> <?php $kweri = $dbcon->query("SELECT * FROM booking INNER JOIN cottages on cottages.cot_id = booking.cottage_id LEFT JOIN members on members.cust_id = booking.customer_id WHERE (date_reserved BETWEEN '$from' and '$until') and book_status = 'Canceled'") or die(mysqli_error()); while($row = $kweri->fetch_assoc()) { ?> <tr> <td><?php echo $row['cot_type']?></td> <td><?php echo $row['walkin_fname']?><?php echo $row['walkin_lname']?><?php echo $row['cust_fname']?><?php echo $row['cust_lname']?></td> <td><?php echo $row['date_reserved']?></td> <td> <div class="label label-primary"><?php if($row['customer_id'] == '0'): echo 'Walkin'; endif;?></div> <div class="label label-success"><?php if($row['customer_id'] > '0'): echo 'Online'; endif;?></div> </td> </tr> <?php } echo'</table>'; } ?>

-------------Problems Reply------------

change

<td><?php echo $row['date_reserved']?></td>

to

<td><?php echo date('F-d-Y' ,strtotime($row['date_reserved']))?></td>

Category:php Views:7 Time:2018-12-24
Tags: php mysql html

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.165 (s). 11 q(s)