note 38184 deleted from function.strtotime by didou

From: Date: Thu, 11 Dec 2003 09:34:19 +0000
Subject: note 38184 deleted from function.strtotime by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61785@lists.php.net to get a copy of this message
Note Submitter: php@bartman.prv.pl.REMOVEIT ---- Here is a simple function for those (like me) who use different notation of a date. A date 1981-06-26 in Poland (I don't know if it's used in other countries of Europe) should be written 26-06-1981. So this function just converts date to timestamp so you can safely compare dates or use getdate() to extract month, day etc. Just pass a string with a date with month, day and year separated with "-" (still you can change it to other characters) function StrToTimestamp($str) { $date = explode("-",$str); //swaps places of year and day return strtotime($date[2]."-".$date[1]."-".$date[0]); }

« previous php.notes (#61785) next »