PROGRAMMING

 
REMEMBERS




Last update:   29-10-2021

Extract

Extracts parts from the date.
 
SELECT EXTRACT(YEAR FROM '2009-07-02');

       -> 2009
Date Add    (2/3)

Date 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    (3/3)

Days 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    
Foreign key

        A B C D E F
🔔
1/1