I have a number for average time. I want to return time format like "00:00:12" How can i do it?
a_function(){
$sum_duration = Model::where('as_user_id',$this->id)->sum('duration');
//sum_duration = 21
$week_count = $first_impression->created_at->diffInWeeks($last_impression->created_at);
//week_count = 2
$time = date_create(round($sum_duration / ($week_count == 0? 1:$week_count)));
//false
return date_format( $time,"H:i:s");
}
The above code is not working.
How can i change to show time format like 00:00:00 ((H:i:s))