use the Visual Basic Namespace. (and the VB.Net forum)
Printable View
use the Visual Basic Namespace. (and the VB.Net forum)
This also allows you to pick the starting week
Code:Function WNO(Indate As Date) As Integer
WNO = Format(Indate, "ww", vbSunday, vbFirstFullWeek)
End Function
or
Function WNO(Indate As Date) As Integer
WNO = Format(Indate, "ww", vbSunday, vbAAA)
End Function
where AAA =
vbFirstFullWeek
vbFirstFourDays
vbFirstJan1
vbUseSystem
ALSO 1st day of the week can be specified eg, Monday or Sunday
No direct format.
But you can get the result this way .....
MsgBox(DateDiff("w", "01/01/" & Year(Now), Now) & Format(Now, "yy"))