Answer the question
In order to leave comments, you need to log in
Why is there an error in PHP?
Hello! Tell me why the error occurs?
$date = $_POST["date"]; # Приходит в таком формате 12.11.19 - 29.11.19
if (!empty($date)){
$dateFull = str_replace(' ', '', $date);
list($date_from, $date_to) = split('[-]', $dateFull);
$amoCRM_field["date_from"] = DateTime::createFromFormat('d.m.y', $date_from)->format('Y-m-d'); # Необходимо получить 2019-11-12
$amoCRM_field["date_to"] = DateTime::createFromFormat('d.m.y', $date_to)->format('Y-m-d'); # Необходимо получить 2019-11-29
}
Answer the question
In order to leave comments, you need to log in
And why do you have split on line 61? The method is considered deprecated and in PHP 7 (maybe you have it) it is not. You can use explode, preg_split.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question