bnickles1961 Posted May 20, 2014 Share Posted May 20, 2014 Hi guys, I'm new to this forum and hope this is the right place to post this question. I run an internet radio station using SAM Broadcaster. I am trying to display the duration of the song on my main page without the front zero (see enclosed picture): I want the duration to display like this: example (5:47) instead of with the front zero (05:47) Here is a snipet of the code I think it needs to be changed in here somewhere: <td><?php echo preg_replace("/[^!<>@&\/\sA-Za-z0-9_]/","", $row['title']); ?><br><a href="javascript:void(0);" class="album"><strong><?php echo preg_replace("/[^!<>@&\/\sA-Za-z0-9_]/","", $row['artist']); ?></strong></a> (<?php echo date('i:s',$row['duration'] / 1000); echo $duration[0] === '0' ? substr($duration, 1) : $duration; ?>)<div class="albuminfo"> <?php if(!$row['album']) { echo "No Album Specified"; } else { ?><strong>From album:</strong> <?php echo $row['album']; ?><?php } ?></div></td> <td align="right"> <?php if ($first) { $first = false; ?><font color="red"><strong>ON-AIR NOW</strong></font><?php } else { ?><strong><?php echo date('h:ia', strtotime($row['date_played'])); ?> EST</strong><? } ?> <?php if(!$row['code'] == "200") { // if there is no request } else { ?> <br> Requested By: <strong><?php if(!$row['name']) { echo "An Oldies Lover"; }else{ echo $row['name']; } ?></strong><br> <?php if(!$row['msg']) { }else{ echo '<em>"'.$row['msg'].'"</em>'; } ?> <?php } ?> </td> Any help would be appreciated Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted May 20, 2014 Share Posted May 20, 2014 Try changing this date('h:ia', strtotime($row['date_played'])) To this: date('g:ia', strtotime($row['date_played'])) Note that I changed the "h" to "g". More information about the date() function can be found here: http://php.net/manual/en/function.date.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.