Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21849

just a bit more age work

$
0
0
in the following code I am able to get the age of a person based on the year but not on the month... for example a person born june 26 1986 is written as being 27 but they shuld be 26 untill its past june of this year. What changes if possible must be made to use the month properly?

Code:

Private Sub Command1_Click()
Open "C:\Test\Patient.txt" For Output As #2

sPatientDoB = "06-26-86"
dateDOb = DateSerial(Mid$(sPatientDoB, 7, 2), Mid$(sPatientDoB, 1, 2), Mid$(sPatientDoB, 4, 2))
age = DateDiff("yyyy", dateDOb, Date$)
Print #2, age
Close #2
End Sub


Viewing all articles
Browse latest Browse all 21849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>