How to convert this string
$parent = "2011-08-04 15:00:01";
to separate it into two strings:
$child1= "2011-08-04";
$child2 = "12:00:01";
And then convert
$child1 to this format 8.4.2011
and
$child2 to this format 15:00
$time = new DateTime("2011-08-04 15:00:01");
$date = $time->format('n.j.Y');
$time = $time->format('H:i');
$parent = '2011-08-04 15:00:01';
$timestamp = strtotime($parent);
$child1 = date('n.j.Y', $timestamp); // d.m.YYYY
$child2 = date('H:i', $timestamp); // HH:ss
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With