note 73466 deleted from function.mktime by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 03:33:37 +0000 |
| Subject: | note 73466 deleted from function.mktime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142073@lists.php.net to get a copy of this message | ||
Note Submitter: derrick dot miller dot DONTSENDMEJUNK at axis80 dot com
----
Here's a handy function which will convert dates in MySQL format (yyyy-mm-dd) to a Unix
timestamp. While this can also be done within MySQL queries via the UNIX_TIMESTAMP() function, it
is not always convenient to do so.
// Returns the Unix timestamp of a MySQL date (YYYY-MM-DD)
function mysqldate_to_unix_timestamp($date) {
list($year, $month, $day) = explode('-', $date);
return mktime(0, 0, 0, $month, $day, $year);
}