|
-
Dec 2nd, 2002, 07:30 PM
#1
Thread Starter
Member
Date Question - Visual Basic 6.0
Hello programmers:
Please I need help.
-- I am writing a process in which SUNDAY is the first day of the week
-- I need to dectect the beginning of the last week. For example:
a) 11/25/2002 (SUN) - 11/30/2002 (SAT). This is my last week
b) 12/02/2002 is the current date
I need to detect the firts day of the last week and add the date (mm/dd/yy) into an array. I am need to add only the Seven days.
Can somebody help me how to acompllish this task.
Thanks to all for your time
-
Dec 2nd, 2002, 10:33 PM
#2
Member
Hi !
Hope this helps at least as a starting point :
Code:
For i = 1 To -7 Step -1
If WeekDay ( Date + i )= 1 Then ' 1 = Sunday... 7 = Saturday
Text1 = Date + i ' Store in Text Box for you to move it somewhere else
Debug.Print Date + i ; " was Last Sunday"
End If
Next i
-
Dec 2nd, 2002, 10:46 PM
#3
Member
I was thinking about my own problems moving day by day for some specific reasons ( I do some "time measuring" with very special behaviours ).
If all you need is last Sunday you could use this one :
Code:
Text1 = Date - WeekDay ( Date ) + 1
and if needed some Sundays before ( or after ) you can just subtract ( or add ) 7, 14, etc. in a loop as long as you need.
-
Dec 9th, 2002, 09:31 PM
#4
Thread Starter
Member
Thanks
Thanks alot for your advice and time. It woks well.
Daniel
Hollywood, FL
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
|