Req #46383 [Opn->Wfx]: Additional date/time functions

From: Date: Wed, 11 Jan 2017 16:12:40 +0000
Subject: Req #46383 [Opn->Wfx]: Additional date/time functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206521@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=46383&edit=1 ID: 46383 Updated by: heiglandreas@php.net Reported by: zoe at monkeehouse dot com Summary: Additional date/time functions -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Date/time related Operating System: * PHP Version: * Block user comment: N Private report: N New Comment: This issue is by now open for more than 8 years. And as the two functions can easily be created in userland I'm closing this. Feel free to reopen should the need arise. Previous Comments: ------------------------------------------------------------------------ [2008-10-24 23:15:45] zoe at monkeehouse dot com 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 this bug report at https://bugs.php.net/bug.php?id=46383&edit=1

« previous php.bugs (#206521) next »