I have already researched a lot of site on how can I convert PHP DateTime object to String. I always see \"String to DateTime\" and not \"DateTime to String\"
PHP D
Its worked for me
$start_time = date_create_from_format('Y-m-d H:i:s', $start_time); $current_date = new DateTime(); $diff = $start_time->diff($current_date); $aa = (string)$diff->format('%R%a'); echo gettype($aa);