note 26089 added to function.strtotime

From: Date: Thu, 17 Oct 2002 17:52:03 +0000
Subject: note 26089 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-38212@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.strtotime.php http://master.php.net/manage/user-notes.php?action=edit+26089 http://master.php.net/manage/user-notes.php?action=delete+26089 http://master.php.net/manage/user-notes.php?action=reject+26089

« previous php.notes (#38212) next »