Return to Snippet

Revision: 5034
at February 6, 2008 11:07 by razel


Initial Code
function create_timestamp($date) { // Format : DD.MM.YYYY 
	if	(preg_match("/^([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})$/i",$date))
		{
			$expDate=explode(".",$date);
			if(strlen($expDate[0])=="1"){$expDate[0]="0".$expDate[0];}
			if(strlen($expDate[1])=="1"){$expDate[1]="0".$expDate[1];}
			return mktime(0,0,0,$expDate[1],$expDate[0],$expDate[2]);
		}
	else return false;
}

Initial URL


Initial Description
Forms a php timestamp out of an date string i.e. create_timestamp(24.12.2007);

Initial Title
create_timestamp

Initial Tags
date

Initial Language
PHP