Click or drag to resize

GoMonth Function (Date, Long)

X#
Returns the date that is a specified number of months before or after a given Date or Date/Time expression.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION GoMonth(
	dExpression AS DATE,
	iNumberOfMonths AS LONG
) AS DATE
Request Example View Source

Parameters

dExpression
Type: Date
Specifies a date expression for which GoMonth( ) returns the date.
iNumberOfMonths
Type: Long
Specifies the number of months from the date or date/time. If nNumberOfMonths is positive, GoMonth( ) returns a date that is nNumberOfMonths months after the date or date/time. If nNumberOfMonths is negative, GoMonth( ) returns a date that is nNumberOfMonths months before the date or date/time. For example, -1 means -31 days.

Return Value

Type: Date
Date
Remarks
GoMonth( ) does not support dates earlier than 1753.
Examples
X#
1Set CENTURY ON
2gdDeadLine = GoMonth({^1998-02-16}, 5)
3Clear
4? gdDeadLine  // Displays 07/16/1998
5? GoMonth({^1998-12-31}, 2)  // Displays 02/28/1999
6? GoMonth({^1998-12-31}, -2)  // Displays 10/31/1998
See Also