I am creating a delivery system in PHP but cannot get the date to come out as DAY dd/mm/yyyy currently it comes out as yyyy/mm/dd which I understand is the default.
I am using the following code to display the delivery date within the lightbox:
<?php echo $Deliverydate; ?>
After looking around and doing some research I found this alternative:
<?php
$source = '2015-05-12';
$date = new DateTime($source);
echo $date->format('d.m.Y'); // 31.07.2012
?>
However as the delivery dates are stored in a MySQL database using the following code I get an error within the lightbox.
$source = '$Deliverydate';
This gives me the error:
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string $Deliverydate; at position 0 (<): Unexpected character' in /home4/rylshieldltd/public_html/sandgcrm/getOrder.php:63 Stack trace:
0 /home4/rylshieldltd/public_html/sandgcrm/getOrder.php(63): DateTime->__construct('/home4/rylshieldltd/public_html/sandgcrm/getOrder.php on line 63
If anyone could help me pull the time through from the database using PHP and also display the correct day for the date selected that'd be greatly appreciated.