0

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

2
Contributors
2
Replies
6
Views
7 Years
Discussion Span
Last Post by sethm
0

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') )"

Edited by urtrivedi: n/a

0

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

Edited by sethm: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.