How to change format time from hh:mm:ss to hhmmss in php?

In this tutorial, we show you how you can convert format time from hh:mm:ss to hhmmss in php.

1. Code:

    <?php 
	function changeFormatTimeToHHMM($time){
	    $time = trim($time);
	    $time = str_replace(":", "", $time);
	    return $time;
	}
	$date1 = "02:03:33";
	echo(changeFormatTimeToHHMM($date1));
    ?> 

2. Example:

Input:

"02:03:33"

Output:

020333