Equinox Online Help - Language Reference - A to Z

Home

WeekOfYear

Applies to
SyntaxWeekOfYear DateExpression, WeekNumber, YearNumber
Action[Statement] Returns the week number and year for a given date.
ScopeUsable anywhere.
Notes

This function is mostly useful when the system workarea SysFirstWeek is set to 2, indicating that Equinox should calculate week numbers according to the ISO 8601 standard. In that standard, weeks are numbered from 1 to 53, and week 1 starts on the week containing the first Thursday in the year. The days at the start and end of the year may in fact belong to weeks in the year before or after. In that case, the year returned in YearNumber will differ from the year in the date. In every other circumstance, and for all other values of SysFirstWeek, the year will be the same as in DateExpresssion.

The Week function returns the year in the system workarea SysReply, and this is an alternative way to get the information.

CategoryDate handling
See Also Zoom, Years, Year, Day, Dayname, Dayofweek, Dayofyear, Dmy, Dmyadd, Leapyear, Month, MonthName, Months, ServerDateTime, Today, Week, WeekStart
Example

This example checks to see if New Years day 2010 is in the first week of the year or in a week that started the previous year. (As New Years day 2010 is a Friday the statement should be triggered.)

number wk, yr

sysFirstWeek=2
WeekOfYear '1-1-2010', wk, yr
If yr <> 2010 then print "This day is in the previous year"