|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-02 01:59 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Date/time related
-Operating System:
+Operating System: *
-PHP Version: 6CVS-2008-10-24 (CVS)
+PHP Version: *
[2017-01-11 16:12 UTC] heiglandreas@php.net
-Status: Open
+Status: Wont fix
[2017-01-11 16:12 UTC] heiglandreas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 19:00:02 2025 UTC |
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); }