Output of Age calculation in year month date
Source CODE Visual Programming Data picker control
Private Sub Command1_Click()
Text1.Text = DTPicker2.Year - DTPicker1.Year
Text2.Text = DTPicker2.Month - DTPicker1.Month
Text3.Text = DTPicker2.Day - DTPicker1.Day
If (DTPicker2.Month < DTPicker1.Month) Then
Text2.Text = Val(Text2.Text) + 12
Text1.Text = Val(Text1.Text) - 1
End If
If (DTPicker2.Day < DTPicker1.Day) Then
Text3.Text = Val(Text3.Text) + 30
Text2.Text = Val(Text2.Text) - 1
End If
End Sub
0 Comments