verifica se anno bisestile,controllo tempi trascorsi, con visual basic
inserire anno, (tempo inizio prova e tempo fine prova)
cliccare ver controllo e calcolo
VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UserForm2 Caption = "UserForm2" ClientHeight = 4560 ClientLeft = 45 ClientTop = 330 ClientWidth = 7545 OleObjectBlob = "bisestile.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "UserForm2" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False 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