Get dates based on the day (1 Viewer)

minii

Registered User.
Local time
Today, 03:07
Joined
Nov 8, 2010
Messages
26
Hi,

So what I'm looking at doing is getting dates for the current weeks Monday and Saturday. I think what I'd need to do is look at todays date say that came back as Thursday 19/1/2012, I then would want it to get me Monday's date and Saturday's date and put them in the necessary field for each. I assume VBA would be the best way to do this. Sorry if I didn't explain it well.

Many thanks.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:07
Joined
Sep 12, 2006
Messages
15,710
without checking the functions above, i tend to just do this sort of thing. Maybe a handful of extra clock cycles, but immaterial in programme execution time, I would think.

so for a saturday (say)

while weekday(checkdate)<>vbsaturday
checkdate=checkdate-1
wend
 

raskew

AWF VIP
Local time
Yesterday, 21:07
Joined
Jun 2, 2001
Messages
2,734
Hi -

Assuming you are working with Sunday = 1 thru Saturday = 7
For Monday of Current Week:
? date() - weekday(date())+ 2
1/23/2012

For Saturday of Current Week:
? date() - weekday(date())+ 7
1/28/2012

HTH - Bob
 

Users who are viewing this thread

Top Bottom