I have a PHP function which inserts a date value from my SQL database into my PHP page here
$DateSql = "SELECT * FROM `ins_schedule` WHERE `active` = 1";
$DateResult = mysqli_query($connect, $DateSql);
$DateResultCheck = mysqli_num_rows($DateResult);
if ($DateResultCheck > 0){
while($row = mysqli_fetch_assoc($DateResult)){
echo "<p style=\"margin-left: 15px;\">{$row[('insider_date')]}</p>";
}
}
This method works fine for printing out the date like this
2020-01-31
But I want the date data to print out as "January 31, 2020". Would anyone know how to output the data like this?
There's a couple ways to do date formatting in PHP. Here I use the
DateTime::format()method: