Re: First Monday of the week
- From: Göran Andersson <guffa@xxxxxxxxx>
- Date: Tue, 12 Jun 2007 20:05:02 +0200
The first monday of the week? As far as I know, there are rarely more than one monday in a week... ;)
sweetpotatop@xxxxxxxxx wrote:
Hi,
I wonder if there is any function in VB or SQL that will return the
date of first Monday of the Monday.
Neither does mondays often contain more than one monday... ;)
There is no built in function to return the first monday of a month. You can get the weekday of the first day of the month, and use that to determine how many days to add to get to the monday.
Something like:
Dim first as DateTime = New DateTime(year, month, 1)
Dim day as Integer = Cast(first.DayOfWeek, Integer)
If day <= 1 Then day = day + 7
Dim firstMonday as DateTime = first.AddDays(8 - day)
Besides, is there are a way finding the numbers of Monday in a month?
One way could be to just repeatedly add seven days to the date until it reaches the next month.
--
Göran Andersson
_____
http://www.guffa.com
.
- References:
- First Monday of the week
- From: sweetpotatop
- First Monday of the week
- Prev by Date: Re: Reference RunTime Control
- Next by Date: Re: Printing from the print preview screen
- Previous by thread: Re: First Monday of the week
- Next by thread: Re: First Monday of the week
- Index(es):
Relevant Pages
|