how to determine "last week" 
Author Message
 how to determine "last week"

    I need to determine  last monday date and last friday date
based on todays date.
thanks


Mon, 25 Jul 2005 01:08:03 GMT  
 how to determine "last week"
'dlbjr

Set ObjDT = New DateTool
strMonday = ObjDT.PriorMonday
strFriday = ObjDT.PriorFriday
Set ObjDT = Nothing
msgbox "Monday = " & strMonday & " and Friday = " & strFriday

Class DateTool
 Private mdtmSetDate
 Private mintDayOfWeek
 Private Sub Class_Initialize()
  mdtmSetDate = Date
  SetDay
 End Sub
 Private Sub Class_Terminate()
 End Sub
 Public Property Let SetDate(strData)
  If IsDate(strData) Then
   mdtmSetDate = strData
   SetDay
  End If
 End Property
 Public Function PriorMonday()
  Select Case CInt(mintDayOfWeek)
   Case 1
    intDiff = 6
   Case Else
    intDiff = mintDayOfWeek - 2
  End Select
  PriorMonday = DateAdd("d",-intDiff,mdtmSetDate)
 End Function
 Public Function PriorFriday()
  PriorFriday = DateAdd("d",-3,PriorMonday())
 End Function
 Private Sub SetDay()
  mintDayOfWeek = DatePart("w",mdtmSetDate)
 End Sub
End Class



Mon, 25 Jul 2005 05:43:12 GMT  
 how to determine "last week"

:     I need to determine  last monday date and last friday date
: based on todays date.
: thanks

dt = datevalue(now)
lastMonday = dt - weekday(dt,3)
lastFriday = dt - weekday(dt,7)
msgbox lastMonday & vbnewline & lastFriday



Mon, 25 Jul 2005 06:42:57 GMT  
 how to determine "last week"
This will work fine in most situations

What if the workweek in Monday thru Thursday 10 hour days?



Mon, 25 Jul 2005 09:14:36 GMT  
 how to determine "last week"

: This will work fine in most situations
:
: What if the workweek in Monday thru Thursday 10 hour days?
:

My post gets the prior monday, and the prior friday, to today's date, which I believe was what the OP was after.

I can't see the relevance of workweek or of monday to thursday, so I really don't understand your query.



Mon, 25 Jul 2005 09:50:49 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. vbscript for "Week Number"

2. displaying a "week number" in subject

3. "Horizontal" Week

4. "Horizontal" Week

5. List "Week of:..."

6. This week on "The RIGHT Perspective"

7. How to determine last week of a year?

8. "Last saved by" property

9. Obtaining "last accessed" info recursively

10. inet control "Still executing last request"

11. Changing "last saved by" property

12. Please ignore last posting: "hello world"

 

 
Powered by phpBB® Forum Software