How to change the normal input date format dd-mm-yyyy in the webpage to yyyy-mm-dd while storing in the php my admins
Asked
Active
Viewed 2,810 times
-1
-
2Did you tried anything with `date` function? – GautamD31 Oct 27 '14 at 10:06
-
2possible duplicate of [Convert one date format into another in PHP](http://stackoverflow.com/questions/2167916/convert-one-date-format-into-another-in-php) – GautamD31 Oct 27 '14 at 10:08
2 Answers
3
you can convert the date with strtotime();
$dateToday = date("d-m-Y");
$newDate = date("Y-m-d", strtotime($dateToday));
And then you can store data to your database.

Akhil Clement
- 575
- 1
- 7
- 17