Page 1 of 1

date formatting

Posted: Tue Mar 13, 2007 7:38 pm
by crazytopu
Hi guys

How can I use date function to send date,month and year to the database and store it in a date column?

Code: Select all

// year  month and day received from user input
echo $year;  
echo $month;
echo $day;


$post_date = date('Y,m,d');

$required_by = date('$year,$month,$day');  // I want to save it as the above date format

echo $required_by;
I get this long output -
$07eamWed, 14 Mar 2007 00:31:17 +0000,$03o33112,$14am07'

Posted: Tue Mar 13, 2007 11:37 pm
by feyd
You don't even need the date function for this unless the information you are writing is not in the proper forms already.

In addition, you have a single quote string. No variables are processed in single quote strings, hence the long and confusing result.