In MySQL, you can use the DATE_SUB()
function to subtract a specified amount of time from a date. For example, you can use it to subtract 7 days from a given date. You can specify whether to subtract days, weeks, months, quarters, years, etc. You can also subtract a time value, such as seconds, microseconds, etc.
This function is similar to DATE_ADD()
, except that it subtracts from a date instead of adds to it.