Week number calculations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RobinDiederen
    New Member
    • Sep 2006
    • 19

    Week number calculations

    Hi,

    Suppose I have a date, is there some way I can use Access to calculate the week number the date is in? And if so, can Access take notice of leap years?

    Thanks!
  • Andrew Thackray
    New Member
    • Oct 2006
    • 76

    #2
    the function is

    week(YourDate)

    Access automatically takes care of leap years

    Comment

    • RobinDiederen
      New Member
      • Sep 2006
      • 19

      #3
      Originally posted by Andrew Thackray
      the function is

      week(YourDate)

      Access automatically takes care of leap years
      Thanks a lot!

      Another question: can this be domne the other way around to? Can I access to give me, for example, the date of the first day of a week?

      Comment

      • PEB
        Recognized Expert Top Contributor
        • Aug 2006
        • 1418

        #4
        Hi,

        So there is a function

        Weekday(MyDate)

        That can help you about

        In fact there isn't function week() in Access...

        The function for the week is:

        Datepart("ww", Your Date)

        :)

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          Originally posted by PEB
          Hi,

          So there is a function

          Weekday(MyDate)

          That can help you about

          In fact there isn't function week() in Access...

          The function for the week is:

          Datepart("ww", Your Date)

          :)
          To expand on on PEB's post ...

          DatePart ("ww", date)

          returns the week number of any date, the default for week one is the week containing January 1st. The first day of the week defaults to sunday.

          to get the day of the week of any date

          Weekday (date) returns a number 1 to 7, 1 being sunday

          WeekdayName (Weekday (date)) returns the week day name in Full

          WeekdayName (Weekday (date), True) returns abbreviated week day name

          Comment

          Working...