From:             zoe at monkeehouse dot com
Operating system: 
PHP version:      6CVS-2008-10-24 (CVS)
PHP Bug Type:     Feature/Change Request
Bug description:  Additional date/time functions

Description:
------------
Two PHP functions that replicate the MySQL functions of the same name. 
These may be useful to other people given how popular the combination of
PHP and MySQL is.

Reproduce code:
---------------
function time_to_sec($time) {
        $hours = substr($time, 0, -6);
        $minutes = substr($time, -5, 2);
        $seconds = substr($time, -2);

        return $hours * 3600 + $minutes * 60 + $seconds;
}

function sec_to_time($seconds) {
        $hours = floor($seconds / 3600);
        $minutes = floor($seconds % 3600 / 60);
        $seconds = $seconds % 60;

        return sprintf("%d:%02d:%02d", $hours, $minutes, $seconds);
}


-- 
Edit bug report at http://bugs.php.net/?id=46383&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46383&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46383&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46383&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46383&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46383&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46383&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46383&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46383&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46383&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46383&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46383&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46383&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46383&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46383&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46383&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46383&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46383&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46383&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46383&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46383&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46383&r=mysqlcfg

Reply via email to