Using datepart to set the first day of the week

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tarohn
    New Member
    • Mar 2010
    • 1

    Using datepart to set the first day of the week

    I am trying to use datepart to to set the first day of the week as Thursday. Problem is I have looked at the examples of the code and I can not seem to figure out what I need to type to make it work. I have 0 experience when it comes to VB coding so I normally try and find an example of what I want and simply copy and paste it but I have not been able to find an example. Can someone spell out the datepart function for me so I can try and make this work?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    The FirstDayOfWeek Arugument has relevance only for the w (Weekday) and ww (Week) Intervals. A couple of examples, with Output, based on the Current Date (3/16/2010) and Weekday Interval, are:
    Code:
    ? DatePart("w",#3/16/2010#,vbTuesday,vbFirstJan1)
     1   
    
    ? DatePart("w",#3/16/2010#,vbWednesday,vbFirstJan1) 
     7 
     
    ? DatePart("w",#3/16/2010#,vbThursday,vbFirstJan1) 
     6 
    
    ? DatePart("w",#3/16/2010#,vbMonday,vbFirstJan1) 
     2
    Look at the the Help File for complete details on its use.

    Comment

    Working...