This question already has an answer here:
-
Convert one date format into another in PHP
15 answers
In the database, date format is Y-m-d, im trying to display my result with this format d-m-Y.
This is my code:
<input name="personal_ic_from" type="text" class="tcal" id="personal_ic_from" value="<?php echo $personal_ic_from ?>" readonly="readonly"/>
Follow the procedural style in php
<?php
$databaseDate = '2013-09-29 01:02:03';
$date = date_create($databaseDate);
echo date_format($date, 'd-m-y');
?>
You can also try strtotime()
<?php
$queryResultDate = mysqli_query("SELECT column_name FROM table_name"); //selecting the date column
$date = date("d-m-y" , strtotime($queryResultDate));
echo $date;
?>