Click or drag to resize

Month Function

X#
Extract the number of the month from a date.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION Month(
	dDate AS DATE
) AS DWORD
Request Example View Source

Parameters

dDate
Type: Date
The date.

Return Value

Type: DWord
A number from 0 to 12. Specifying a NULL_DATE returns 0.
Remarks
Month() is a date conversion function that is useful when you require a numeric month value during calculations for such things as periodic reports. Month() is a member of a group of functions that return components of a date value as numbers.
The group includes Day() and Year() to return the day and year values as numerics. CMonth() is a related function that allows you to return the name of the month from a date value.
Examples
These examples return the month of the system date:
X#
1? Today()                        // 09/01/90
2? Month(Today())                // 9
3// Advance by 1 month:
4? Month(Today()) + 1            // 10
This example uses month along with Day() and Year():
X#
1?"We are", Year(Today()), "years, ",;
2        Month(Today()), "months, and", Day(Today()),;
3            "days into our history!"
This example shows the result when a NULL_DATE is passed:
X#
1? Month(NULL_DATE)                // 0
See Also