Login     Register

        Contact Us     Search

XLeratorDB/financial Documentation

SQL Server EDATE function


EDATE
 
Updated: 5 August 2010
Use EDATE to calculate the date that is the indicated number of months before or after a specified date (the start date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
 
Syntax
SELECT [westclintech].[wct].[EDATE] (
   <@Start_date, datetime,>
 ,<@Months, int,>)
 
Arguments
@Start_date
The date the number of months is added to or subtracted from. @Start_date is an expression that returns a datetime or smalldatetime value, or a character string in date format. 
@Months
an integer added to the @Start_date representing the number of months before or after the startdate. @Months is an expression of type int or of a type that can be implicitly converted to int.
Return Type
datetime
Remarks
Use @Months to calculate a date prior to the @Start_date
Examples
SELECT wct.EDATE('8/31/2008',6)
 
Here is the result set
-----------------------
2009-02-28 00:00:00.000
 
 
SELECT wct.EDATE('8/31/2008',-6)
 
Here is the result set
-----------------------
2008-02-29 00:00:00.000
 
 
SELECT wct.EDATE('4/30/2008',1)
 
Here is the result set
-----------------------
2008-05-30 00:00:00.000
 
 
SELECT wct.EDATE('5/30/2008',-1)
 
Here is the result set
-----------------------
2008-04-30 00:00:00.000
 
 
SELECT wct.EDATE('5/31/2008',-1)
Here is the result set
-----------------------
2008-04-30 00:00:00.000


Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service