RE: [PHP] Date data type problem

From: Date: Mon, 15 Jan 2001 22:11:45 +0000
Subject: RE: [PHP] Date data type problem
Groups: php.general 
Request: Send a blank email to php-general+get-34699@lists.php.net to get a copy of this message
> while $date1 is in "yyyymmdd" format but $date2 is in > "yyyy-mm-dd" formate because I get value of $date2 from a > "date" data type field from a table. Ah, see ... this is what I was talking about with making sure they are in the same format :) > Can I use this "yyyy-mm-dd" to compare with value from > another date variabile in the "yyyymmdd" format? If not > possible, How do I make both of them to be in the same format? You can change yyyy-mm-dd to yyyymmdd like this: $withoutdashes = ereg_replace("[^0-9]", "", $withdashes); This wil actually remove everything from the string that is not a number between 0 and 9 (ie, numbers). Jason -- Jason Murray jasonm@melbourneit.com.au Web Design Team, Melbourne IT Fetch the comfy chair!

« previous php.general (#34699) next »