How to get date??

  • MMartin1 (10/4/2016)


    peter478 (10/3/2016)


    Let me explain what I need.

    Based on last day in month I found week number via function DatePart("ww", 30.11.2016) result is 40 or other. It does not matter.

    The task is just to find another date if I know week number, year, day.

    Just to make a note here :: In SQL SERVER:

    SET DATEFIRST 7 /* makes Sunday the start of the week */

    SELECT DatePart(ww, '20161002') /*results in 41 */

    SET DATEFIRST 1 /* makes Monday the start of the week */

    SELECT DatePart(ww, '20161002') /* The same date, results in 40 */

    So the week you are in does depend on the how you configure the week start day.

    From a little experimentation in Access, it appears that the week numbers are defined as follows >

    1, Sunday

    2, Monday

    .

    ..

    ...

    7,Satruday

    So the equivalent to the above in MS Access would be :

    SELECT

    datepart("ww", #2016-10-02#, 1) as givenSundayStart,

    datepart("ww", #2016-10-02#, 2) as givenMondayStart

    EDIT: fixed some formatting.

    ----------------------------------------------------

  • Thank you Martin.

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply