Reference > TDBDateX Object > TDBDateX Object Methods > WeekInfo Method (TDBDateX) |
WeekInfo Method (TDBDateX)
You can use the WeekInfo method to determine the week of the (fiscal) year, the week of the (fiscal) year half, week of the (fiscal) year quarter and the week of the month for a given date. This calculation is controlled by the WeekPattern property which determines how one week should be treated and counted. The weeks you retrieve also may be influenced by the setting of the StartOfWeek property which determines the first starting weekday of the week.
object.WeekInfo ([Date], [YearType], [TypeInfo])
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 |
typeinfo is an optional constant that determines which period is used in date calculations. The typeinfo argument has these settings:
0 |
Year (Default) |
1 |
Year half |
2 |
Year quarter |
3 |
Month |
An integer representing the week number of the specified period. If date is set to Null or the target date is not within the specified period, this method returns -1.
For example, when WeekPattern is set to 0-Row pattern (the default) and StartOfWeek is set to 1-Sunday (the default), Aug. 10, 1998 will return 33 for the week of year and 7 for the week of year half. However, if WeekPattern is set to 1-Full week pattern, 32 for the week of year and 6 for the week of year will be returned.
If the date is not specified, the date set in the Value property will be applied for the underlying value.
When typeinfo is set to 3-Month, the yeartype option will be ignored, since the type for the year will not make much sense in this case.
By default, the start of weekday will be picked up from the system.
When WeekPattern pattern is set to 0-Row, a week that crosses over multiple months will be treated as a single week.
See Also
WeekPattern Property (TDBDateX)
StartOfWeek Property (TDBDateX)
FiscalYear Property (TDBDateX)
FiscalHalf Property (TDBDateX)