Answer the question
In order to leave comments, you need to log in
Date problem?
Guys please help.
There is
// Это дата добавления пользователя (2021-06-10 08:10:52)
$data1 = new DateTime($client_test->add_time);
// Это дата добавления пользователя (2021-06-11 08:10:52) + 1 day
$data2 = new DateTime($client_test->add_time . ' +1 day');
<? if (data1 > data2) { ?>
<?php echo "on" ?>
<? } elseif (data1 < data2)) { ?>
<?php echo "off" ?>
<? } ?>
Answer the question
In order to leave comments, you need to log in
new DateTime($client_test->add_time . ' +1 day'); is a class. Those. You are comparing class with class. And you need to compare dates or their timestamp.
Perhaps you should equate and use other variables for comparison - ->format('Ymd H:i');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question