• This is Slide 1 Title

    This is slide 1 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...

  • This is Slide 2 Title

    This is slide 2 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...

  • This is Slide 3 Title

    This is slide 3 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...

Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Tuesday, 6 May 2014

MySQL Function : DATE_ADD()

MySQL Function : DATE_ADD()

Definition:
Get date for specific time interval.

Syntax:
DATE_ADD(date, INTERVAL expr type)

Example - 01:
SET @ExampleDate = '2014-01-01';
SELECT DATE_ADD(@ExampleDate, INTERVAL 20 DAY) AS 'Add20Days';

Output:   2014-01-21

Example - 02:
SET @ExampleDate = '2014-01-01';
SELECT DATE_ADD(@ExampleDate, INTERVAL 6 WEEK);

Output:   2014-02-12

Important Notes:
Type Value :
MICROSECOND
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
QUARTER
YEAR
SECOND_MICROSECOND
MINUTE_MICROSECOND
MINUTE_SECOND
HOUR_MICROSECOND
HOUR_SECOND
HOUR_MINUTE
DAY_MICROSECOND
DAY_SECOND
DAY_MINUTE
DAY_HOUR 
YEAR_MONTH