My code is something like this and we are facing problem when we use date in hindi and while saving to database it also throwing error and its not readable in php. We have changed it by Locale php standard function
$array = [$date1, $date2, date('Y-m-d', strtotime($date2))];
print_r($array);
Array
(
[0] => 2014-08-10
[1] => 2018-12-26
[2] => 2018-12-26
)
Array
(
[0] => 2019-01-31
[1] => 30-जनवरी-2019 //We are using hindi
[2] => 1970-01-01 //Throwing wrong data it should be 2019-01-30
)
Warning : date_diff() expects parameter 2 to be DateTimeInterface, boolean given
Notice: Trying to get property of non-object