|
-
Jul 7th, 2002, 07:46 PM
#1
Thread Starter
PowerPoster
*RESOLVED* Given a date return the date of Monday the same week
I'm stumped. The title says it all.
I need the date of Monday for the same week as any date entered. I'm using the system settings for the first day of week.
For some reason I can get it to work unless the day selected is the first day of the week. In that case it always selects the monday of the previous week. For all other dates it works fine.
VB Code:
dMonday = DateAdd("d", -Weekday(dSelectedDate, vbMonday) + 1, dSelectedDate)
Last edited by cafeenman; Jul 7th, 2002 at 08:06 PM.
-
Jul 7th, 2002, 07:55 PM
#2
-
Jul 7th, 2002, 07:58 PM
#3
Frenzied Member
USe this:
VB Code:
dMonday = DateAdd("d", -(Weekday(dSelectedDate, vbUseSystemDayOfWeek) - dSelectedDate), dSelectedDate)
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jul 7th, 2002, 08:05 PM
#4
Thread Starter
PowerPoster
OK, this gets it.
VB Code:
dStartDate = DateAdd("d", Weekday(vbMonday) - Weekday(mvSchedule.Value), mvSchedule.Value)
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
|