Friday, November 9, 2007

count date different (selisih tanggal)


with vb, its very easy to calculate the different between two date.
we can count the different based on day or month.
we need dtpicker object. it object is a member of microsoft windows common control 2-6.0
here is the source code...

Private Sub Command1_Click()
If Option2.Value = True Then
Text1.Text = DateDiff("m", tgl1.Value, tgl2.Value)
Label4.Caption = "Bulan"
Else
Text1.Text = DateDiff("d", tgl1.Value, tgl2.Value)
Label4.Caption = "Hari"
End If
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Option3.Value = True
tgl1.Value = Now
tgl2.Value = Now
End Sub

click here to download...

No comments: