note 9432 modified in strtotime by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Fri, 03 Nov 2000 23:46:04 +0000 |
| Subject: | note 9432 modified in strtotime by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7364@lists.php.net to get a copy of this message | ||
[Editor's note: MySQL does have a function to handle the conversion UNIX_TIMESTAMP (read the
MySQL manual for more details). So, in reality there is no need to do a post-query manipulation in
this case, just ask for "SELECT ..., UNIX_TIMESTAMP(datetime_field) ..."]
Here is a 1 line trick to convert a MySQL time into a timestamp :
$time = mktime( substr( $sqltime, 0, 2), substr( $sqltime, 3, 2));
Simple, but i didn't find it in the suggestions !
http://www.php.net/manual/function.strtotime.php