Options

Get first monday of week from a week number ?

gazpachogazpacho Member Posts: 48
Hi

Is there a quick way to retrieve the date of the first monday of a week when the only thing known is the week number and the year ?

Thanks in advance

Gazz

Comments

  • Options
    Tim81Tim81 Member Posts: 68
    Hi,

    there is a possibility. Use the table "Date". Set "Period Type" = Week (e.g. Date.SETRANGE("Period Type",Date."Period Type"::Week);).

    Then set a filter for "Period Start" to the needed year ("01.01.05..31.12.05"). Then look for the right "Period No." and the given "Period Start" is the first day of the week!
  • Options
    FPulsfortFPulsfort Member Posts: 43
    This gives the help:

    DWY2DATE
    Use this function to return a date based on a weekday, a week, and a year.

    Date := DWY2DATE(WeekDay [, Week] [, Year]))
    Date

    Data type: date

    The resulting date.

    Weekday

    Data type: integer

    The number of the day in the week (1..7). Monday is day number 1.

    Week

    Data type: integer

    The number of the week. January 1 falls in week number 1. If you omit this optional parameter, the system uses the current week as the default.

    Year

    Data type: integer

    The four-digit number of the year. If you omit this optional parameter, the system uses the current year as the default.



    Hope this helps.

    Greetings,
    Frank
  • Options
    gazpachogazpacho Member Posts: 48
    Thanks Frank, works perfectly. Should've found this one out myself, though :?
Sign In or Register to comment.