Is there a way to give me Sunday's date on the 11th week of this year in this formatt?
dd/mm/yyyy
thanks
Printable View
Is there a way to give me Sunday's date on the 11th week of this year in this formatt?
dd/mm/yyyy
thanks
use them like this:Code:Function StartDateOfWeek(iWeekNo As Integer, iYearNo As Integer) As Date
Dim d As Date
d = "01.01." & iYearNo
StartDateOfWeek = d + ((iWeekNo - 1) * 7)
End Function
Function NextDay(ByVal d As Date, ByVal DayCode As Long) As Date
NextDay = d - Weekday(d) + DayCode + IIf(Weekday(d) < DayCode, 0, 7)
End Function
peetCode:MsgBox Format(NextDay(StartDateOfWeek(11, Year(Date)), vbThursday), "dd/mm/yyyy")
This works really well!
Code:Function CJulian2Date (JulDay As Integer, Optional YYYY)
If IsMissing(YYYY) Then YYYY = Year(Date)
If Not IsNumeric(YYYY) Or YYYY \ 1 <> YYYY Or YYYY < 100 Or YYYY _
> 9999 Then Exit Function
If JulDay > 0 And JulDay < 366 Or JulDay = 366 And _
YYYY Mod 4 = 0 And YYYY Mod 100 <> 0 Or YYYY Mod 400 = 0 Then _
CJulian2Date = DateSerial(YYYY, 1, JulDay)
End Function
To test this function, type the following line in the Debug window and then press ENTER:
?CJulian2Date(32, 1996)