...

View Full Version : php date format



santille
12-09-2010, 03:11 PM
Hello,

Please any help about that.
Here is the code :



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

DataTalk
12-09-2010, 04:25 PM
Hello,

Please any help about that.
Here is the code :



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

just change this to "d-m-y"

santille
12-09-2010, 04:45 PM
Thank you for your answer.
No way with this task : that's the first thing I tried.

DataTalk
12-09-2010, 04:52 PM
I just tyied it the output was 09-12-2010 instead of 2010-12-09


<?php
for($m = 0;$m <= 0; $m++)
{
$now = date ("d-m-Y", mktime (0,0,0,date("m"),date("d")+$m,date("Y")));
echo "<input type='text' name='open_date' value='$now'>";
}
?>

santille
12-09-2010, 05:06 PM
Could you tell me exactly how did you test to obtain this result?
It does not return that for me...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum