19 lines
634 B
PHP
19 lines
634 B
PHP
<?php
|
|
/**
|
|
* Formats the given date range from string 'd/m/Y' to date object'd-m-Y'.
|
|
*
|
|
* @param array $dateParts An array containing the start and end dates
|
|
* in 'd/m/Y' format or in any format where the datatype is string.
|
|
* @return array An array with formatted start and end dates in 'd-m-Y' format.
|
|
*/
|
|
|
|
|
|
function datePicker($dateParts){
|
|
$fromDate = $dateParts[0];
|
|
$toDate = $dateParts[1];
|
|
$date['dateTime']= \DateTime::createFromFormat('d/m/Y', $fromDate);
|
|
$date['dateTime1'] = \DateTime::createFromFormat('d/m/Y', $toDate);
|
|
return $date;
|
|
}
|
|
|
|
?>
|