Click or drag to resize

Day Function

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

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

Parameters

dDate
Type: Date
The date.

Return Value

Type: DWord
The day of the month, as a number in the range 0 to 31.
If the day is February 29 and the year is not a leap year, Day() returns 0.
For an invalid or NULL_DATE, Day() returns 0.
Remarks
Day() is a date conversion function that is useful when you require a numeric day value during calculations for such things as periodic reports. Day() is a member of a group of functions that return components of a date value as numbers.
The group includes Month() and Year() to return the month and year values as numerics.
CDoW() is a related function that allows you to return the name of the day from a date value.
Examples
These examples show the Day() function used several ways:
X#
1? Today()                    // 09/01/90
2? Day(Today())                // 1
3? Day(Today()) + 1            // 2
4? Day(0.0.0)                    // 0
This example uses Day() in combination with CMonth() and Year() to format a date value:
X#
1? CMonth(Today()) + Str(Day(Today())) + ;
2    "," + Str(Year(Today()))        // June 15, 1990
See Also