ComponentOne True DBInput Pro 8.0
EnumWeekdays Method (TDBDateX)

 

Reference> TDBDateX Object> TDBDateX Object Methods> EnumWeekdays Method (TDBDateX)

EnumWeekdays Method (TDBDateX)

The EnumWeekdays method allows you to retrieve all dates for the specified weekday of which weeks in month, by setting the options with weekday and weekofmonth. For example, you can retrieve all Saturdays in the current month or only the first and the last Saturdays.

Syntax

object.EnumWeekdays ([StartDate], EndDate, Array, [Weekday], [WeekOfMonth])

Remarks

startdate is an optional Variant (Date) that is a starting date for a range. If not specified, the Value property will be applied.

enddate is a required Variant (Date) that is an ending date for a range.

array is a required variant, a variable for retrieving all date results.

weekday is an optional constant that specifies which weekday.

weekofmonth is an optional constant that specifies the number of weeks in month.

The weekday argument has these settings:

1

Sunday (Default)

2

Monday

3

Tuesday

4

Wednesday

5

Thursday

6

Friday

7

Saturday

The weekofmonth argument has these settings:

-1

All weeks of month (Default)

0

No weeks

1

First week of month

2

Second week of month

4

Third week of month

8

Fourth week of month

16

Fifth week of month

32

Last week of month

Return Value

The array argument returns a Variant (Date) array (0 based), enumerating all dates for the specify number of the weekday within the given date of range. This method returns a long integer corresponding to the number of elements contained in the array. If EnumWeekdays could not enumerate any matching dates, array will return Null, and the method itself will return 0. If startdate is not specified, the date set in the Value property will be applied for the underlying value. If either startdate or enddate is set to Null, the array will return Null, and the method itself will return -1.

Notes

The size of the array should not be dimensioned before passing it in as a variable. The EnumWeekdays method will automatically generate the size and enumerate all date values in the Variant variable.

The EnumWeekdays method allow you to use the UBound and the LBound functions provided in Visual Basic to determine the largest and the smallest available subscript for the indicated dimension in array.

See Also

Weekday Property (TDBDateX)

StartOfWeek Property (TDBDateX)

DayInfo Method (TDBDateX)

StartDate Method (TDBDateX)

EndDate Method (TDBDateX)

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback