Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-09-2010, 02:11 PM   PM User | #1
santille
New Coder

 
Join Date: Aug 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
santille is an unknown quantity at this point
php date format

Hello,

Please any help about that.
Here is the code :
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
santille is offline   Reply With Quote
Old 12-09-2010, 03:25 PM   PM User | #2
DataTalk
Regular Coder

 
Join Date: Nov 2010
Location: Oregon
Posts: 219
Thanks: 19
Thanked 10 Times in 10 Posts
DataTalk is an unknown quantity at this point
Quote:
Originally Posted by santille View Post
Hello,

Please any help about that.
Here is the code :
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"
DataTalk is offline   Reply With Quote
Old 12-09-2010, 03:45 PM   PM User | #3
santille
New Coder

 
Join Date: Aug 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
santille is an unknown quantity at this point
Thank you for your answer.
No way with this task : that's the first thing I tried.
santille is offline   Reply With Quote
Old 12-09-2010, 03:52 PM   PM User | #4
DataTalk
Regular Coder

 
Join Date: Nov 2010
Location: Oregon
Posts: 219
Thanks: 19
Thanked 10 Times in 10 Posts
DataTalk is an unknown quantity at this point
I just tyied it the output was 09-12-2010 instead of 2010-12-09

Code:
<?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'>";
} 
?>
DataTalk is offline   Reply With Quote
Old 12-09-2010, 04:06 PM   PM User | #5
santille
New Coder

 
Join Date: Aug 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
santille is an unknown quantity at this point
Could you tell me exactly how did you test to obtain this result?
It does not return that for me...
santille is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:26 PM.


Advertisement
Log in to turn off these ads.