Forum Moderators: open

Message Too Old, No Replies

Find what month week starts in

         

david_ste

4:39 pm on Dec 7, 2005 (gmt 0)

10+ Year Member



currentDate = date()
wkNo = datepart("w", currentDate)

Gets my week no as in 48 but how can i find what month that week starts in.

mattglet

10:26 pm on Dec 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this should do it (not tested):

currentDayOfWeek = WeekDay(currentDate)

If Not currentDayOfWeek = 1 Then
'--- Get Sunday's Date
tempDate = DateAdd("d", -1 * (currentDayOfWeek - 1), currentDate))
End If

'--- Get what month Sunday's Date is in
theMonth = Month(tempDate)

mrMister

11:29 am on Dec 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



currentDate = date()
wkNo = datepart("w", currentDate)
mthNo = month(currentDate)

mattglet

4:29 pm on Dec 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think he wanted the month in which the "week starts in", not the month of the date.