SELECT * FROM table
WHERE INVOICE_DATE .....(30 days have passed since today).....
example:
today = 2021-11-05
2021-11-04 non select
2021-10-07 non select
2021-10-04 select
2021-09-27 select
CodePudding user response:
This works, current date minus 30 days
SELECT * FROM table
WHERE INVOICE_DATE < CURRENT_DATE() - INTERVAL 30 DAY
CodePudding user response:
You can do it using time
library in python language.
Here's an example of how it can be done.
First of all, record the current date and time.
import time
# This will store current datetime in epoch
epoch = time.time()
Then we import another library that will convert epoch to human-readable format.
import datetime
# This will return a date and time of exactly 30 days before today
dateToSelect = datetime.datetime.fromtimestamp(int(epoch)-2592000)