- SELECT
- Order By Rand
- Concat Fields
- Between
- Regexp
- If Null
- Union
- Replace
- Using Syntax
- Substring
- DATE
- Get Date
- Date Format
- Today
- Month Day
-
Date Parts
- ADMINISTRATION
- Foreign Key
- Foreign Key Disable
- Innodb
- Create Database
- Create Table
- Add Column
- Add Index
- Data Type
- Primary Key
- Errors
- Indexes
- Mysqldump
- Table Definition
MYSQL PAGES - LEVEL 3
Date add / Add
Add days (months, years) to a date.
SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);
-> 2008-02-02
SELECT ADDDATE('2008-01-02', 31);
-> 2008-02-02
Days difference / Difference
Returns the difference in days from one date to the other. Only the date parts of the values are used in the calculation.
SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
-> 1
Questions and answers:
Clink on Option to Answer
1. Add days to day
- a) SELECT {{ADDDATE}}('2008-01-02', INTERVAL 31 DAY);
- b) SELECT {{DATEDIFF}}('2008-01-02', INTERVAL 31 DAY);