The below code displays date in yyyy-mm-dd
<td>
<?php
echo($data['Date']);?></td>
<td>
I want it in mm-dd-yyyy
$originalDate = "2010-03-21";
$newDate = date("m-d-Y", strtotime($originalDate));
$s_date = $_POST['your_date_field'] // your date variable in '2015-10-10 ' formate
echo date('m-d-Y',strtotime($s_date)) // return 10-10-2015
Try this
Use strtotime($data['Date'])
to convert string to date time
and the use date('md-Y',strtotime($data['Date']))
to format it to your requirement
<td>
<?php echo date('m-d-Y',strtotime($data['Date']));?>
</td>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.