Thanks
Converting Date format
Moderator: General Moderators
-
webphotogeek
- Forum Newbie
- Posts: 18
- Joined: Sun Jul 04, 2010 12:11 pm
Converting Date format
Can someone tell me how I go about changing a date, such as 08/11/12 to the European format in MySQL so that I can save it to the database. The date column is in type Date.
Thanks
Thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Converting Date format
Code: Select all
echo date('Y-m-d', strtotime('08/11/12'));-
webphotogeek
- Forum Newbie
- Posts: 18
- Joined: Sun Jul 04, 2010 12:11 pm
Re: Converting Date format
Thanks, but I'm still a little confused as to how to incorporate this function into the Insert statement. The date is actually a variable and I'm capturing it here: $date = $_POST["date"]; then using this MySQL statement here: $pur="INSERT INTO Purchasing(ID, Item, Description, Quantity, Price, Date, AMPM)VALUES('$cust_id','$item_a','$description_a','$quantity1','$price1','$date','$ampm')";
Also, when I ecohed it, it came back as the 8/11/10 and not 2010-08-10.
Sorry if this sounds elementary. I just started getting back into PHP after a few years.
Thanks for your help!
Also, when I ecohed it, it came back as the 8/11/10 and not 2010-08-10.
Sorry if this sounds elementary. I just started getting back into PHP after a few years.
Thanks for your help!