Solved

How to format time

Posted on 2010-09-14
3
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Why isn't my DIV and Form centering? 1 25
Help installing Laravel app on MAMP on MAC 7 53
Load string Array from file 23 37
php time 12 22
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
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…

738 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