• This is one excellent algorithm to get the ISO week number.

    However doing this by using 17530101 instead of 19000101 throws an error

    Arithmetic overflow error converting expression to data type datetime.

    It turns out the highest integer value "DATEPART(DAYOFYEAR" can accept 2958463. Which is 8100 years, which accidentally is the number of years between 1900 and 9999 and number of days between 19000101 and 99991231. My guess is that a developer over at Microsoft has hardwired this upper limit.


    N 56°04'39.16"
    E 12°55'05.25"