Xbasic

# WEEK_ISO_FULL Function

Syntax

ISO_Week as C = week_iso_full(date as D)

Arguments

dateDate

The date to be analyzed.

Returns

ISO_WeekCharacter

Returns the fully qualified ISO week in the format "YYYY-W##-d" where "YYYY" is the year, "W##" is the week number (01-53), and d is the day of the week (1-7).

Description

Get the full ISO week in the format "YYYY-W##-d" where YYYY is the year, W## is the week number, and d is the day of the week.

Discussion

The WEEK_ISO_FULL() function returns the full ISO week format "YYYY-W##-d". This format indicates the year, ISO week number, and day of week for a specified date. For example, consider the date June 11, 2012:

`dim date as d = {7/11/2012}`

ISO_WEEK_FULL() returns the following string for this date:

```? week_iso_full(date)
= "2012-W28-3"```

From this string, we can determine the following information about June 11, 2012:

• June 11, 2012 belongs to a week in the year 2012.
• June 11, 2012 falls in week 28 of the calendar year.
• June 11, 2012 is the third day of the week.

If a date falls at the end or beginning of a year, it may be contained in the week of the adjacent year. WEEK_ISO_FULL() can be used to determine if the week for a date at the beginning or end of the year belongs to a different calendar year:

```' January 3, 1999 is the last day in week 53 for the 1998 calendar year:
? week_iso_full({1/3/1999})
= "1998-W53-7"

? week_iso_full({1/4/1999})
= "1999-W01-1"

' December 29, 2003 is the first day in week 1 for the 2004 calendar year:
? week_iso_full({12/29/2003})
= "2004-W01-1"

? week_iso_full({12/28/2003})
= "2003-W52-7"```