Jump to content

PHP Time format


technophobe

Recommended Posts

Hello,

 

I am new to this site so please execuse my ignorance, I have piece of code that returns a time of 00:00:00 however I only want it to return 00:00. ie. 00:11:56 instead of 11:56.

 

Can anyone help

 

Thanks

 

 Time commenced:  
      <select name="time_commenced" id="time_commenced">
        <option value="<?php echo date('Hi'); ?>"><?php echo date('Hi'); ?></option>
        <?php    
$start = strtotime('0700');
$end = strtotime('2000');
?>
        <?php
for ($i = $start; $i <= $end; $i += 360)
{
?>
        <option value="<?php echo date('Hi', $i); ?>"><?php echo date('Hi', $i); ?></option>
        <?php
}
?>
      </select>      
       Time completed:
       <select name="time_completed" id="time_completed">
         <option value="<?php print date("Hi", mktime()+(6*60)); ?>"><?php print date("Hi", mktime()+(6*60));?></option>
         <?php
for ($i = $start; $i <= $end; $i += 360)
{
?>
         <option value="<?php echo date('Hi', $i); ?>"><?php echo date('Hi', $i); ?></option>
         <?php
}

Link to comment
https://forums.phpfreaks.com/topic/278622-php-time-format/
Share on other sites

Use code tags next time you post (the <> button)

 

Read the manual page for date. It has everything you need to know about formatting a timestamp.

 

The code you've posted won't produce the output you're describing however. So you may have other issues.

Link to comment
https://forums.phpfreaks.com/topic/278622-php-time-format/#findComment-1433336
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.