ICalendarDimension.DateFromWeek

Syntax

DateFromWeek(Year: Integer; Week: Integer; Day: Integer): DateTime;

Parameters

Year - calculated year.

Week - week index in the year. Indexing starts with 0.

Day - the number of days from the week start depending on which date is calculated.

Description

The DateFromWeek method calculates the date corresponding to the specified day. Calculation takes into account week starting day and number of days in a week specified for this dictionary.

Example

Executing the example assumes that the repository contains a calendar dictionary with the CALENDAR_DIM identifier. The year 2009 is included into calendar period. Dictionary structure includes the Weeks level. The following settings are defined in week options; First week day - Monday; Number of week days - 5.

Sub Main;

Var

MB: IMetabase;

Dim: ICalendarDimension;

d: DateTime;

Begin

MB := MetabaseClass.Active;

Dim := MB.ItemById("CALENDAR_DIM").Bind As ICalendarDimension;

d := Dim.DateFromWeek(2009, 0, 0);

Debug.WriteLine(d.ToString);

d := Dim.DateFromWeek(2009, 0, 4);

Debug.WriteLine(d.ToString);

d := Dim.DateFromWeek(2009, 10, 5);

Debug.WriteLine(d.ToString);

End Sub Main;

After executing the example development environment console displays the following calculated values:

29.12.2008 00:00:00

01.01.2009 00:00:00

13.03.2009 00:00:00

See also:

ICalendarDimension | ICalendarDimension.WeekFromDate