Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Private Sub Command1_Click()
MsgBox "Dazwischen liegen:" & vbCrLf & _
ZeitDifferenz(Now, "31.12.2007 12:00:00")
End Sub
Private Function ZeitDifferenz(ByVal datStart As Date, ByVal datEnd As Date) As String
Dim intYear As Integer, intMonth As Integer
Dim intYD As Integer, intMD As Integer, intWD As Integer, intTD As Integer
Dim intHD As Integer, intND As Integer, intSD As Integer
If DateDiff("s", datStart, datEnd) >= 0 Then
intYear = Year(datStart)
intMonth = Month(datStart)
intYD = Year(datEnd) - intYear
intMD = Month(datEnd) - intMonth
intTD = Day(datEnd) - Day(datStart)
intHD = Hour(datEnd) - Hour(datStart)
intND = Minute(datEnd) - Minute(datStart)
intSD = Second(datEnd) - Second(datStart)
If intSD < 0 Then
intND = intND - 1
intSD = intSD + 60
End If
If intND < 0 Then
intHD = intHD - 1
intND = intND + 60
End If
If intHD < 0 Then
intTD = intTD - 1
intHD = intHD + 24
End If
If intTD < 0 Then
intMD = intMD - 1
intTD = intTD + Day(DateSerial(intYear, intMonth + 1, 0))
End If
intWD = Int(intTD / 7)
intTD = intTD - (intWD * 7)
If intMD < 0 Then
intYD = intYD - 1
intMD = intMD + 12
End If
ZeitDifferenz = intYD & " Jahr(e), " & intMD & " Monat(e), " & intWD & " Woche(n), " & intTD & " Tag(e), " & intHD & " Stunde(n), " & intND & " Minute(n), " & intSD & " Sekunde(n)"
Else
ZeitDifferenz = "Keine"
End If
End Function