View unanswered posts | View active topics It is currently Wed Nov 29, 2023 7:02 pm

Reply to topic  [ 3 posts ] 
 php date format 
Author Message
Junior Member

Joined: Thu Aug 05, 2004 1:08 pm
Posts: 9
Post php date format

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,


Thu Dec 09, 2010 8:12 am
Report this post
Junior Member

Joined: Sun Jan 02, 2011 12:30 pm
Posts: 5
Post Re: php date format
use this function

function GermanToUsa($date)
if ( mb_ereg( "([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})", $date, $regs ) )
//$german_date_format = "$regs[3].$regs[2].$regs[1]";
$usa_date_format = "$regs[3]-$regs[2]-$regs[1]";
} else {
    echo "Invalid date format: $date ";
return $usa_date_format;

Tue Jan 04, 2011 12:16 am
Report this post
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
© Copyright 2003-2008 The ultimate PHP Editor and PHP IDE site.