note 126113 deleted from function.strtotime by cmb
| From: | cmb@php.net | Date: | Wed, 26 May 2021 16:17:13 +0000 |
| Subject: | note 126113 deleted from function.strtotime by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216434@lists.php.net to get a copy of this message | ||
Note Submitter: teste at gmail dot com
----
public static function verifyDateInStr($date, $dateStart)
{
$array = [
"ANOS" => "years",
"ANO" => "year",
"MESES" => "month",
"MES" => "month",
"MÃS" => "month",
"DIAS" => "days",
"DIA" => "day",
"SEMANAS" => "weeks",
"SEMANA" => "week"
];
$date = str_replace(",", " ", $date);
$date = str_replace(" E ", " ", $date);
$date = strtr($date, $array);
$date = " +" . $date;
$date = preg_replace('!\s+!', ' ', $date);
$final = date("Y-m-d", strtotime($dateStart . $date));
return $final;
}
$dateStart = '2021-05-26'
$date = '3 ANOS, 1 DIAS E 1 SEMANAS 1 MES'
return '2024-07-04'