note 86589 added to book.datetime

From: Date: Fri, 24 Oct 2008 22:52:43 +0000
Subject: note 86589 added to book.datetime
Groups: php.notes 
Request: Send a blank email to php-notes+get-145727@lists.php.net to get a copy of this message
Should you want to convert between HH:MM:SS and plain seconds like in MySQL, these functions should do the trick: 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); } ---- Server IP: 92.48.74.199 Probable Submitter: 82.69.105.163 ---- Manual Page -- http://www.php.net/manual/en/book.datetime.php Edit -- https://master.php.net/note/edit/86589 Del: integrated -- https://master.php.net/note/delete/86589/integrated Del: useless -- https://master.php.net/note/delete/86589/useless Del: bad code -- https://master.php.net/note/delete/86589/bad+code Del: spam -- https://master.php.net/note/delete/86589/spam Del: non-english -- https://master.php.net/note/delete/86589/non-english Del: in docs -- https://master.php.net/note/delete/86589/in+docs Del: other reasons-- https://master.php.net/note/delete/86589 Reject -- https://master.php.net/note/reject/86589 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145727) next »