Solved

How to format time

Posted on 2010-09-14
3
251 Views
Last Modified: 2012-05-10
$time = "08:00:00";  (Hour:Minute:Seconds)

How could I get rid of the two zeroes for second?
0
Comment
Question by:lericson
  • 2
3 Comments
 
LVL 9

Expert Comment

by:Sander Stad
ID: 33673117
0
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 33673192
See if this makes sense for you:

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

Best
0
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 33679399
Sorry for mistake, this is correct:

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

Cheers
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now