CalcDate




Dim date1 As Date
Dim show As String
Dim dy As Long
Dim dh As Long
Dim ds As Long
' Validation - make sure you at least enter something

If IsNull(txtYr.Text) Then
MsgBox "Prego inserire il campo"
Exit Sub
End If
If IsNull(txtDt.Text) Then
MsgBox "Prego inserire il campo"
Exit Sub
End If
If txtDt.Text > 31 Or txtDt.Text < 1 Then
MsgBox "Data non valida"
txtDt.SetFocus
Exit Sub
End If
date1 = CDate(txtYr.Text & "-" & comMt.Text & "-" & txtDt.Text)
show = show & "Start Date: " & date1 & vbCrLf
show = show & vbCrLf & "End Date: " & Now
'Calcolo

dy = DateDiff("yyyy", date1, Now)
dh = DateDiff("h", date1, Now)
ds = DateDiff("s", date1, Now)
txtDYr.Text = dy
txtDHr.Text = dh
txtDSc.Text = ds
lblShow.Caption = show











( calcdate.html )- by Paolo Puglisi - Modifica del 17/12/2023