Hi,I have problem about convert string format d/m/y to date for insert to database
but i don't know how to convert it
That's a nice idea. Make use of the database features, I like it.
Convert the "UK" formatted string to a date, where dashes are used to tell PHP that it's in d-m-y format:
$ukdate = "15-06-09";
$time = strtotime($ukdate);
$mysqldate = date('Y-m-d H:i:s', $time);
Then $mysqldate will be in an appropriate format to enter in the database.
US date format is m/d/y
UK date format is d-m-y
Notice the difference in separators? If you use those different separators, then functions like strtotime will automatically interpret them correctly for you.
Another alternative would be using mysqls function str to date.
Just make sure that $date is the same format as %d/%m/%Y
how to do it?
example string is "15/06/09"
but when i convert is "31/12/1969"
I don't know what's format of datetime for insert to database
What's different if i insert "d/m/y" and "Y/m/d"