I am receiving 2 date formats:
1/22/2020
1/22/20
I need to convert 1/22/2020
to 1/22/20
I currently use the following but I am not sure how to do a check and convert it before to add my dates
foreach($header as $field){
if (preg_match("/([1-9]|1[0-2])\/([1-9]|[1-2][0-9]|3[0-1])\/[0-9]{2}$/",$field)) {
if($insert){
$days[] = ["date" => $field, $type => $value[$field]];
}
else{
$date_index = array_search($field, array_column($globalData[$index]['data'], 'date'));
$globalData[$index]['data'][$date_index][$type] = $value[$field];
}
}
}