I have a simple section in which a user can select a range of date.
PHP to get these dates from datepicker
if (isset($_POST['from_date']) && isset($_POST['to_date'])) {
$firstDate= $_POST['from_date'];
$lastDate= $_POST['to_date'];
var_dump($firstDate);
var_dump($lastDate);
}
From the above PHP script, I am getting this
string(10) "08/13/2019"
string(10) "08/14/2019"
But I want this
string(10) "2019-08-13"
string(10) "2019-08-14"
What do I need to do to achieve what I want?