In general, the goal is this: It is necessary to make the placement of a post for a time (1 year), that is, after a year the post should not be displayed.
The idea was to create 2 variables in the database, 1 - the current date, 2 - the end date of the publication of the post and if the current date 1 becomes more than the date 2, then we make the post not activated.
So the problem is that I don’t understand how to work with dates in the table, what to use (datetime or timestamp) and what value to put in the database itself. Re-read a bunch of information and nothing really helped. The date of the post publication is created, but it is not recorded in the database.
$date = time(); $M = idate('m', $date); $D = idate('d', $date); $Y = idate('y', $date); $H = idate('H', $date); $i = idate('i', $date); $s = idate('s', $date); $date_end = date('Ymd H:i:s', mktime($H, $i, $s, $M, $D, $Y+1)); echo strtotime($date_end); $sql = 'UPDATE `agrousadby` SET `mai_date_end` = '.$date_end.' WHERE `id` = '.$Param['id']; mysqli_query($CONNECT, $sql);