I am trying to create an elapsed time using date_purchased from a database table called order. I know I am getting the date_purchased as I can
<?php echo zen_datetime_short($order->info['date_purchased']); ?>
and get the date and time formatted as 04/20/2014 11:19:56 I'm not good with php and am just starting to learn this but from what I have researched I have tried the following
<?php
$first = $order->info['date_purchased'];
$second = new DateTime( 'Y-m-d H:i:s' );
$diff = $first->diff( $second );
?>
Then I do
<?php echo $diff->format( '%H:%I:%S' ); ?>
Unfortunately the page loads up until my echo and then everything that should appear below it doesn't. I preferably would only want to show minutes and seconds on my output.
Thanks for your help. I'm using php 5.3 on my server.