DATEDIFF do?DATEDIFF calculates the number of days between two dates. It tells you how many days separate one date from another.
You use DATE_ADD with an interval of 10 days. For example: DATE_ADD('2024-01-01', INTERVAL 10 DAY) gives you the date 10 days after January 1, 2024.
DATEDIFF and DATE_ADD?DATEDIFF finds the number of days between two dates. DATE_ADD changes a date by adding a certain amount of time (days, months, etc.) to it.
SELECT DATEDIFF(CURRENT_DATE, '2024-01-01');
This returns the number of days from January 1, 2024, to today.
Use DATE_ADD with INTERVAL 3 MONTH. Example: DATE_ADD('2024-01-01', INTERVAL 3 MONTH) gives April 1, 2024.
DATEDIFF('2024-01-10', '2024-01-01') return?DATEDIFF counts the days between the two dates, excluding the start date, so it returns 9.
DATE_ADD adds a specified interval (days, months, etc.) to a date.
DATE_SUB subtracts a time interval from a date.
DATE_ADD('2024-02-28', INTERVAL 1 DAY) return?2024 is a leap year, so adding 1 day to Feb 28 gives Feb 29.
DATEDIFF returns the number of days between two dates.