In PHP project development, it is often used to automatically determine the expiration time of some records. The existing database has an automatic update time timestamp.
In PHP project development, it is often used to automatically determine the expiration time of some records. The existing database has an automatic update time timestamp.
In PHP project development, it is often used to automatically determine the expiration time of some records. There is an automatic update time timestamp Field in the existing database. The value of another field is updated for more than 7 days based on the comparison between this time and the current system time. You can directly use the following SQL statement:
Update testtable set status = 2 where datediff (now (), testtime)> 7 and status;
DATEDIFF () returns the number of days between the start time expr and the end time expr2. Expr and expr2 are date or date-and-time expressions. Only the date portion of these values is used in the calculation.