Hi, does anyone know whether its possible to add 30/60 or 90 days to a date in a SQL statement?<br><br>e.g. Add 30 days to 1/06/2000 would equate to 1/07/2000.<br><br>Thanks<br><br>Mike
Depends on what flavor of SQL you are using. The following examples add 30 days to todays system date:<br><br>Oracle - <br>SYSDATE + 30<br><br>Access - <br>DateAdd('d', 30, DATE())<br><br>Those are the two I know. Hope it helps...<br><br> <p>Terry M. Hoey<br><a href=mailto:th3856@txmail.sbc.com>th3856@txmail.sbc.com</a><br><a href= > </a><br>
SQL Server doesn't have a date datatype, just datetime and smalldatetime. <br>DATEADD(day, 30, GETDATE()) adds 30 days to the current system datetime.<br>There is a time value associated with that, so to get rid of that<br>DATEADD(day, 30, CONVERT(char(10),GETDATE(),101)) adds 30 days to the current system date. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.