A
A
aftar2019-10-22 11:24:39
PHP
aftar, 2019-10-22 11:24:39

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
}

5daebcf92289b812283176.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gor Mkhitaryan, 2019-10-22
@aftar

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 question

Ask a Question

731 491 924 answers to any question