Solved

How to format time

Posted on 2010-09-14
3
258 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 31

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 31

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

860 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