dd.mm.yy
Folgende Funktion:
Function getFixDateBefore(ByVal yearsBefore As Integer, monthsFix As String) As String Application.Volatile LYear = CLng(Format(Now - 365 * yearsBefore, "yyyy")) getFixDateBefore = Format(convert_yyyyMMdd_AsDate(CStr(LYear) + monthsFix + "01"), "dd.mm. _ yy") End Function
Function convert_yyyyMMdd_AsDate(v As String) As Date
Dim dt As Date
If v "" And v "0" Then
strYear = Mid(v, 1, 4)
strMonth = Mid(v, 5, 2)
strDay = Mid(v, 7, 2)
dt = CDate(strMonth & "/" & strDay & "/" & strYear)
End If
convert_yyyyMMdd_AsDate = dt
End Function
Wenn ich jetzt ein Datum reinschreibe von heute: Dann soll er 4 Jahre und einen Tag zurückgehen.
4 Jahre klappt. Aber bei 4 Jahren und 1 Tag klappt das nicht...
Jemand eine Inder