php date format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
santille
Forum Newbie
Posts: 17
Joined: Thu Aug 05, 2004 1:31 pm

php date format

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: php date format

Post 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.
Post Reply