note 26089 deleted from function.strtotime by sniper
| From: | sniper@php.net | Date: | Tue, 21 Oct 2003 11:03:01 +0000 |
| Subject: | note 26089 deleted from function.strtotime by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59015@lists.php.net to get a copy of this message | ||
Note Submitter: nick @
----
UK to unix date time
Convert normal UK dd/mm/yy hh:mm:ss format to unix timestamp for php date functions and mysql. Fine
with short/long hand dates and times. eg 31/3/2003 8:15. But not forgiving of extra spaces (would
need reg exp).
function ukDateToUnix($datestr){
list($date,$time)=split(' ',trim($datestr));
list($day,$month,$year)=split('/',$date);
list($hours,$mins,$seconds)=split(':',$time);
$unixtime=mktime($hours,$mins,$seconds,$month,$day,$year);
return $unixtime;
}
Change third line from end for different output formats.