bisestile
Option Explicit
Private Function bisestile(anno As Integer) As Boolean
Dim d As Date
d = DateSerial(anno, 2, 28)
d = d + 1
If Month(d) = 2 Then
bisestile = True
Else
bisestile = False
End If
CommandButton1.SetFocus
End Function
Private Sub CommandButton1_Click()
Dim anno As Integer
TextBox1.SetFocus
anno = TextBox1.Text
If (bisestile(anno)) Then
Lista.AddItem ("bisestile")
Else
Lista.AddItem ("non bisestile")
End If
TextBox1.SetFocus
TextBox1.Text = ""
End Sub
Private Sub CommandButton2_Click()
Dim x As Date
Dim y As Date
x = TextBox2.Text
y = TextBox3.Text
Lista2.AddItem (secondi(x, y))
End Sub
Public Function secondi(inizio As Date, fine As Date) As Long
Dim differenza As Double
Dim risultato As Double
differenza = (fine - inizio)
risultato = (differenza / 1.15740740741499E-05)
secondi = risultato
End Function
Public Function minuti(inizio As Date, fine As Date) As Long
Dim differenza As Double
Dim risultato As Double
differenza = (fine - inizio)
risultato = (differenza / 0.000694444445)
minuti = risultato
End Function
Private Sub CommandButton3_Click()
Lista2.Clear
End Sub
Private Sub CommandButton4_Click()
Dim x As Date
Dim y As Date
x = TextBox2.Text
y = TextBox3.Text
Lista2.AddItem (minuti(x, y))
End Sub