A way to not display minutes if they are zeros?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaybuckner
Forum Newbie
Posts: 1
Joined: Wed Sep 09, 2009 9:30 am

A way to not display minutes if they are zeros?

Post by jaybuckner »

Is there a way to not show the minutes when they are zeros? For example, 3:00 pm should display as 3 pm; however, 3:01 pm should display the same as 3:01 pm. Let it be know that I'm not a coder, but I'm attempting to modify a calendar so that the double zeros don't display. Thanks for any help you can offer.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: A way to not display minutes if they are zeros?

Post by jayshields »

Code: Select all

if($minutes != '00') echo $minutes; //if $minutes is a string
if(($minutes > 0) echo $minutes; //if $minutes is an integer
Last edited by jayshields on Wed Sep 09, 2009 10:30 am, edited 1 time in total.
Post Reply