weekyear - script and chart function
This function returns the year to which the week number belongs according to ISO 8601. The week number ranges between 1 and approximately 52.
Syntax:
weekyear(expression)
Return data type: integer
Examples and results:
Example | Result |
---|---|
weekyear( '1996-12-30' ) | returns 1997, because week 1 of 1997 starts on 1996-12-30 |
weekyear( '1997-01-02' ) | returns 1997 |
weekyear( '1997-12-28' ) | returns 1997 |
weekyear( '1997-12-30' ) | returns 1998, because week 1 of 1998 starts on 1997-12-29 |
weekyear( '1999-01-02' ) | returns 1998, because week 53 of 1998 ends on 1999-01-03 |
Limitations:
Some years, week #1 starts in December, e.g. December 1997. Other years start with week #53 of previous year, e.g. January 1999. For those few days when the week number belongs to another year, the functions year and weekyear will return different values.