devxlogo

Date Subtraction

Date Subtraction

Question:
I have a date field store in one of my database tables. How do I pull a record from that table within seven days of today’s date?

today's date - 7 days

Answer:
To do this, you can use the DateAdd function, but add -7 to the date you want. Here’s an example:

DateAdd('d', -7, getdate())

This will add -7 days to the current date.

devx-admin

Share the Post: