DATE_ADD « Date Time Functions « MySQL Tutorial

MySQL Tutorial
1. Introduction
2. Select Query
3. Database
4. Table
5. Table Join
6. Subquery
7. Insert Update Delete
8. Logic Operator
9. View
10. Data Types
11. Procedure Function
12. Cursor
13. Trigger
14. Date Time Functions
15. Comparison Functions Operators
16. Aggregate Functions
17. Cast Functions Operators
18. Control Flow Functions
19. Encryption Compression Functions
20. Information Functions
21. Math Numeric Functions
22. Miscellaneous Functions
23. String Functions
24. Regular Expressions
25. Data Dictionary
26. MySQL Utilities
27. Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
MySQL Tutorial » Date Time Functions » DATE_ADD 
14. 10. DATE_ADD
14. 10. 1. DATE_ADD(date,INTERVAL expr unit)
14. 10. 2. DATE_ADD(curdate(), INTERVAL 1 MICROSECOND);
14. 10. 3. DATE_ADD(curdate(), INTERVAL 1 MINUTE);
14. 10. 4. DATE_ADD(curdate(), INTERVAL 1 HOUR);
14. 10. 5. DATE_ADD(curdate(), INTERVAL 1 DAY);
14. 10. 6. DATE_ADD(curdate(), INTERVAL 1 WEEK);
14. 10. 7. DATE_ADD(curdate(), INTERVAL 1 MONTH);
14. 10. 8. DATE_ADD(curdate(), INTERVAL 1 QUARTER);
14. 10. 9. DATE_ADD(curdate(), INTERVAL 1 YEAR);
14. 10. 10. DATE_ADD(curdate(), INTERVAL 1.1 SECOND_MICROSECOND)
14. 10. 11. DATE_ADD(curdate(), INTERVAL 1 SECOND);
14. 10. 12. DATE_ADD(curdate(), INTERVAL 1.1 SECOND);
14. 10. 13. DATE_ADD(curdate(), INTERVAL 1.1 MINUTE_MICROSECOND);
14. 10. 14. DATE_ADD(curdate(), INTERVAL 1.1 MINUTE_SECOND);
14. 10. 15. DATE_ADD(curdate(), INTERVAL 1.1 HOUR_MICROSECOND);
14. 10. 16. DATE_ADD(curdate(), INTERVAL 1.1 HOUR_SECOND);
14. 10. 17. DATE_ADD(curdate(), INTERVAL '1:1:1' HOUR_SECOND);
14. 10. 18. DATE_ADD(curdate(), INTERVAL 1.1 HOUR_MINUTE); (with dot)
14. 10. 19. DATE_ADD(curdate(), INTERVAL '1:1' HOUR_MINUTE);
14. 10. 20. DATE_ADD(curdate(), INTERVAL 1.1 DAY_MICROSECOND);
14. 10. 21. DATE_ADD(curdate(), INTERVAL '1 1:1:1' DAY_SECOND);
14. 10. 22. DATE_ADD(curdate(), INTERVAL '1 1:1' DAY_MINUTE);
14. 10. 23. DATE_ADD(curdate(), INTERVAL '1 1' DAY_HOUR);(wihtout :)
14. 10. 24. DATE_ADD(curdate(), INTERVAL 1.1 SECOND_MICROSECOND); (with dot)
14. 10. 25. DATE_ADD(curdate(), INTERVAL '1-1' YEAR_MONTH); (with minus sign)
14. 10. 26. DATE_ADD(curdate(), INTERVAL '1.1' YEAR_MONTH); (with dot)
14. 10. 27. Adding one day to a date: SELECT DATE_ADD('2006-05-01',INTERVAL 1 DAY);
14. 10. 28. Adding one month to a date: SELECT DATE_ADD('2006-05-01',INTERVAL 1 MONTH);
14. 10. 29. Adding one year to a date: SELECT DATE_ADD('2006-05-01',INTERVAL 1 YEAR);
14. 10. 30. Adding one month to start date
14. 10. 31. SELECT DATE_ADD('1997-12-31 23:59:59', 1 SECOND);
14. 10. 32. SELECT DATE_ADD('1997-12-31 23:59:59', 1 DAY);
14. 10. 33. SELECT DATE_ADD('1997-12-31 23:59:59', '1:1' MINUTE_SECOND);
14. 10. 34. SELECT DATE_SUB('1998-01-01 00:00:00', '1 1:1:1' DAY_SECOND);
14. 10. 35. SELECT DATE_ADD('1998-01-01 00:00:00', '-1 10' DAY_HOUR);
14. 10. 36. SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);
14. 10. 37. SELECT DATE_ADD('1992-12-31 23:59:59.000002', '1.999999' SECOND_MICROSECOND);
14. 10. 38. If you add to or subtract from a date value something that contains a time part, the result is automatically converted to a datetime value.
14. 10. 39. SELECT DATE_ADD('1999-01-01', INTERVAL 1 HOUR);
14. 10. 40. If the resulting date has a day that is larger than the maximum day for the new month, the day is adjusted to the maximum days in the new month.
14. 10. 41. Date arithmetic operations require complete dates
14. 10. 42. SELECT '2005-03-32' + INTERVAL 1 MONTH;
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.