I am trying to get my date that people enter into a form from mm/dd/yyyy to input it into the database.

I can't seem to get this to work, I guess I only know enough to hang myself, what would someone use to get this to function properly?

I've been researching it for about 6 hours now, and finally just now came to this thread to see if anyone would be able to assist!

Thanks in advance,
Seth

In your php code Before inserting or updating. use follwoing code

insertquery="insert into mytable (col1,col2,date1) 
values('val1','val2',
date_format(".$_POST['htmldatefieldname']."'%Y-%m-%d') )"

The way I have been trying to do it has been:

$sale_date = $_POST['sale_date'];
	$saledate = new DateTime($sale_date);
	$close_date = date_format($saledate, 'Y-m-d');
	
	$auction = $_POST['auction_date'];
	$auctiondate = new DateTime($auction);
	$auction_date = date_format($auctiondate, 'Y-m-d');

When I print these dates, they actually are in the correct format for the Database, but when I submit them to be input (using their variable names) it doesn't actually place them in the Database, it just leaves it empty.

Thanks for the idea, I did try it, but it didn't seem to work either.
Seth

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.