note 76849 deleted from function.mktime by derick
| From: | derick@php.net | Date: | Sat, 26 Jul 2008 10:05:29 +0000 |
| Subject: | note 76849 deleted from function.mktime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142772@lists.php.net to get a copy of this message | ||
Note Submitter: lb at bostontech dot net
----
As per derrick miller's contribution for MySQL date stamps (which equally applies to pgSQL)...
I find this processes a little faster than exploding the string:
(All done in one statement)
<?php
function unix_date($input_date)
{ // take date string such as "1985-07-25" and return the Unix timestamp
return mktime(0, 0, 0, substr($input_date, 5, 2), substr($input_date, 8, 2), substr($input_date,
0,4));
}
?>