|
-
Sep 22nd, 2005, 12:57 PM
#1
Thread Starter
Lively Member
Date Calculation
I have an SQL statement that returns the week number using the DatePart function. Is their a way I can get the friday date of the week number it returns to me ?
Thanks in advance for any help !!
-
Sep 22nd, 2005, 01:15 PM
#2
Re: Date Calculation
well.. it isnt pretty.. but it works
VB Code:
Dim DTE As Date
Dim tmp As Integer
tmp = WEEK_NUM_FROM_SQL
DTE = CDate("1/1/" & Year(Date)) 'set to the first day of this year
Do Until Format(DTE, "ww") = tmp 'loop till it hits the week returned
DTE = DateAdd("d", 1, DTE)
Loop
Do Until Weekday(DTE) = vbFriday 'find the friday
DTE = DateAdd("d", 1, DTE)
Loop
MsgBox DTE
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 01:16 PM
#3
Re: Date Calculation
Substitute the date for NOW. Weekday() returns an integer.
VB Code:
Option Explicit
Private Sub Form_Load()
MsgBox WeekdayName(Weekday(Now))
End Sub
-
Sep 22nd, 2005, 01:18 PM
#4
Re: Date Calculation
dave, he needs to find the Friday of the week number returned...
like currently its week # 39.. so he would need it to return 9/23/05
(At least thats how I understood it)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|