Page 1 of 1

php date format

Posted: Thu Dec 09, 2010 8:13 am
by santille
Hello,

Please any help about that.
Here is the code :

Code: Select all


for($m = 0;$m <= 0; $m++)
{
$now = date ("Y-m-d", mktime (0,0,0,date("m"),date("d")+$m,date("Y")));
echo "<input type=\"hidden\" name=\"open_date\" value=\"" . $now . "\">";
}

It inserts the actual date in YYYY-MM-DD.
The field "open_date" in the MYSQL table is type "date".
Could you please give the exact modification to give to this code to have DD-MM-YYYY format cause for the moment always 0000-00-00 result...

Thanks a lot,

seb

Re: php date format

Posted: Thu Dec 09, 2010 2:18 pm
by requinix
santille wrote:Could you please give the exact modification
No.
santille wrote:to give to this code to have DD-MM-YYYY format cause for the moment always 0000-00-00 result
MySQL uses YYYY-MM-DD format. Your problem is elsewhere.