MySQL date difference

I use MySQL and PHP, and I want to find the difference between the two dates.

I have a table with a name advertisersthat has a field web_start_date. I want to select all entries where web_start_dateless than 30 days from the current date

+3
source share
4 answers

Just use the datediff function of MySQL.

+14
source
+2
source

WHERE web_start_date < TIMESTAMPADD(DAY, 30, NOW())

0
source

hmmm .. try this, see if this works for you :)

SELECT * FROM advertisers WHERE DATE(web_start_date) > DATE_SUB(NOW(), INTERVAL 30 DAY)
-3
source

Source: https://habr.com/ru/post/1753718/


All Articles