DTP to show first Monday of the month

To find first monday in month you create a new date set to the first in month and check the integer value of DayOfWeek property, it ranges 0-6 for sunday to saturday. Calculate up to the first monday (which has a 1 integer value from DayOfWeek)
 
I found some code on the web that looked like this;

VB.NET:
Dim FirstMondayoftheMonth As Date = DateAdd(DateInterval.Weekday, DateDiff(DateInterval.Weekday, Date.MinValue, DateAdd(DateInterval.Day, 6 - DatePart(DateInterval.Day, Today()), Today())), Date.MinValue)

but that kept giving me a date of 24/08/0287 !

I'll have a go at what you have suggested, thanks for the info.
 
Back
Top