Export (0) Print
Expand All
Expand Minimize

Global::weekOfYear Method [AX 2012]

Retrieves a sequence number based on the latest occurrence of the first day of the week in the year, where that day is before or on the input date, all according to local settings.

client server public static int weekOfYear(date _curDate)

Run On

Called

Parameters

_curDate
Type: date
The date for which the week-of-year information is desired.

Return Value

Type: int
A value between 1 and 53.

The value returned by this method is affected by the local settings of the computer. For more information, you can search the Windows registry and the Web for the strings iFirstDayOfWeekand iFirstWeekOfYear.This method generally returns the sequence number of the latest Sunday of the year before or on the input date value unless there are no more Sundays that year. The return values for dates near the start or end of the year are determined by various details.Assume that the local settings have Sunday as the first day of the week, which means iFirstDayOfWeek=0. Also assume that January 1 is always considered to be part of the first week of the year, which means iFirstWeekOfYear=0. In this context, consider the year 2003.

The first day of 2003 is a Wednesday. This means an input date in January of Saturday 4\1\2003 returns 1, and the next day Sunday 5\1\2003 returns 2.The last day of 2003 is also a Wednesday. An input of Saturday 27\12\2003 returns 52, and Sunday 28\12\2003 returns 1 because there are no more Sundays that year.Unlike the weekOfYear method, the wkOfYr function calculates a return value according to the ISO 8601 specification.

Show:
© 2014 Microsoft