ComponentOne True DBInput Pro 8.0
TotalWeeks Method (TDBDateX)

 

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

TotalWeeks Method (TDBDateX)

You can use the TotalWeeks method to retrieve the total weeks in the specific period by setting yeartype and periods for a given date. This calculation is controlled by the WeekPattern property which determines how one week should be treated and counted (row based or full week based). The weeks you retrieve also may be influenced by the setting of the StartOfWeek property which determines the first starting weekday of the week.

Syntax

object.TotalWeeks ([Date], [YearType], [Periods], [FullWeeksOnly])

Arguments

date is an optional variant (Date): a value that determines the underlying date. If not specified, the date set in the Value property will be applied.

yeartype is an optional constant that determines whether to use the normal year or the fiscal year. The yeartype argument has these settings:

0

Normal year (Default)

1

Fiscal year

periods is an optional constant that determines which period to use in date calculations. The periods argument has these settings:

0

Year (Default)

1

First half

2

Second half

3

First quarter

4

Second quarter

5

Third quarter

6

Fourth quarter

7

Month

fullweeksonly is an optional Boolean that determines whether to include the remaining days that do not constitute a full week. If True, the remaining days are excluded. If False (or not specified), the remaining days are included.

Return Value

An integer representing the total number of weeks within a specified period. If date is set to Null or the target date is not within the specified period, this method returns Null.

Remarks

For example, if WeekPattern is set to 0-Row pattern (the default) and StartOfWeek is set to 1-Sunday (the default), Aug. 10, 1998 will return 27 weeks for the first half of the year and 14 weeks for the first quarter of the year. However, if WeekPattern is set to 1-Full week pattern with the fullweeksonly option set to False, 26 weeks for the first half of the year and 13 weeks for the first quarter of the year will be returned. The fullweeksonly option determines whether to include the remaining days that does not make up a full week or not. If you does not want any left over days included, just simply set this option to True. With this setting, 25 weeks for the first half of the year and 12 weeks for the first quarter of the year will be returned. Note that the fullweeksonly argument takes effect only when the WeekPattern property is set to 1-Full week mode. Also the StartOfWeek property takes effect only when the WeekPattern property is set 0-Row pattern.

The weeks for all the fiscal options, will be calculated based on the month set by the FirstMonth property.

Notes

If date is not specified, the date set in the Value property will be applied for the underlying date. If the Value property is set to Null, this method returns -1.

When periods is set to 7-Month, the yeartype option will be ignored, since the type for the year will not make much sense in this case.

The day part for the underlying date may not have any particular meaning, but it is still required since the date must be defined as a valid Date type.

By default, the start of the weekday will be picked up from the system.

When the WeekPattern property is set to 0-Row, a week that crosses over multiple months will be treated as a single week.

See Also

Value Property (TDBDateX)

WeekPattern Property (TDBDateX)

StartOfWeek Property (TDBDateX)

FirstMonth Property (TDBDate)

Year Property (TDBDateX)

Half Property (TDBDateX)

Quarter Property (TDBDateX)

FiscalYear Property (TDBDateX)

FiscalHalf Property (TDBDateX)

FiscalQuarter Property (TDBDateX)

Month Property (TDBDateX)

Weekday Property (TDBDateX)

TotalDays Method (TDBDateX)

 

 


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

Product Support Forum  |  Documentation Feedback