How to format time

$time = "08:00:00";  (Hour:Minute:Seconds)

How could I get rid of the two zeroes for second?
Lennart EricsonAmateurAsked:
Who is Participating?
 
Marco GasiFreelancerCommented:
Sorry for mistake, this is correct:

echo date('h:i', strtotime("08:00:00"));

Cheers
0
 
Sander StadSysteemontwikkelaar, Database AdministratorCommented:
0
 
Marco GasiFreelancerCommented:
See if this makes sense for you:

$time ="08:00:00";
$mytime = str_replace(":","",$time);
echo date("h:m", $mytime);

Best
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.