Try this one it will work for you.
$array= Array(
0 => '05_00pm_07_00pm|15_04_2016',1 => '03_00pm_05_00pm|15_04_2016',2 => '07_00pm_09_00pm|15_04_2016',3 => '03_00pm_05_00pm|14_04_2016',
4 => '01_00pm_03_00pm|14_04_2016',5 => '01_00pm_03_00pm|15_04_2016',6 => '01_00pm_03_00pm|15_04_2016',7 => '01_00pm_03_00pm|15_04_2016',
8 => '01_00pm_03_00pm|15_04_2016',9 => '01_00pm_03_00pm|15_04_2016',10 => '01_00pm_03_00pm|15_04_2016',11 => '01_00pm_03_00pm|15_04_2016',
12 => '01_00pm_03_00pm|15_04_2016',13 => '07_00pm_09_00pm|14_04_2016',14 => '07_00pm_09_00pm|16_04_2016',15 => '01_00pm_03_00pm|14_04_2016',
16 => '07_00pm_09_00pm|13_04_2016'
);
foreach($array as $key=>$row)
{
$newArr[$key] = explode("|", $row);
$timeArray[] = $newArr[$key][0];
$dateArray[] = $newArr[$key][1];
}
array_multisort($dateArray, SORT_ASC, $timeArray, SORT_ASC, $newArr);
$finalArray = array();
foreach($newArr as $key1=>$row1)
{
$finalArray[] = implode("|",$row1);
}
echo "<pre>";
print_r($finalArray);
Output
Array
(
[0] => 07_00pm_09_00pm|13_04_2016
[1] => 01_00pm_03_00pm|14_04_2016
[2] => 01_00pm_03_00pm|14_04_2016
[3] => 03_00pm_05_00pm|14_04_2016
[4] => 07_00pm_09_00pm|14_04_2016
[5] => 01_00pm_03_00pm|15_04_2016
[6] => 01_00pm_03_00pm|15_04_2016
[7] => 01_00pm_03_00pm|15_04_2016
[8] => 01_00pm_03_00pm|15_04_2016
[9] => 01_00pm_03_00pm|15_04_2016
[10] => 01_00pm_03_00pm|15_04_2016
[11] => 01_00pm_03_00pm|15_04_2016
[12] => 01_00pm_03_00pm|15_04_2016
[13] => 03_00pm_05_00pm|15_04_2016
[14] => 05_00pm_07_00pm|15_04_2016
[15] => 07_00pm_09_00pm|15_04_2016
[16] => 07_00pm_09_00pm|16_04_2016
)
Also check in Online Editor. Click Here
2
solved How to sorting date time in string array php [closed]