Date of upcoming saturday

adambedford

Registered User.
Local time
Tomorrow, 00:12
Joined
Apr 15, 2009
Messages
42
Is there a way to calculate the date of the upcoming saturday. For example, if I opened my report on Thrusday 23rd, it would say Saturday 25th automatically in a label.

Thanks
 
Hi -

From the debug (immediate) window:

Code:
dteMyDate = #4/23/09#
myInt = 7
? dteMyDate - WeekDay(dteMyDate) + myInt + IIf(WeekDay(dteMyDate) >= myInt, 7, 0)
4/25/2009

Myint = the next weekday you wish to find (e.g. Sunday = 1 thru Saturday = 7.

HTH - Bob
 
Thanks, thats excellent!

Is there a way it can be formatted to read "25th April 2009"...so in long date format?
 
Try:

? format(dteMyDate - WeekDay(dteMyDate) + myInt + IIf(WeekDay(dteMyDate) >= myInt, 7, 0), "long date")

Saturday, April 25, 2009

Bob

Added: If you get into '25th April 2009', e.g. each day followed by st, nd, rd, th depending on the particular day, you'rre opening a whole new can of worms. While I can provide additional code to attach the appropriate thingee, have got to ask, 'Is it worth it?'. Will anyone be confused by 'Saturday, April 25, 2009'?

Please give it some thought.

Bob
 
Last edited:
Perfect, thanks!! I won't bother with the the st, nd, th, rd...like you said, it's really not woth it!

Thanks very much for the help.
 
Hey -

Love it when a plan comes together.

Best wishes - Bob
 

Users who are viewing this thread

Back
Top Bottom