Hi All,
I need to find if the person is more than 65 years or not, on the date of service.
I have date of birth as say 06/12/1950 (mm/dd/yyyy) format. And the date of service is 01/16/2015.
When I use =DATEDIF("6/12/1950","1/16/2015","y") formula in excel sheet, it gives 64. which is correct.
When I use the same in VBA.datediff("yyyy", dob, dos), it returns 65.
Pls advise How to get this solved. As this is required in VBA macro, I do not want to use the formula method.
Below is my part of vba code. dob and dos are in string format as input from other process.
Regards,
Prasad DN
PS: I tried web search, all pointers leads to datediff function only
I need to find if the person is more than 65 years or not, on the date of service.
I have date of birth as say 06/12/1950 (mm/dd/yyyy) format. And the date of service is 01/16/2015.
When I use =DATEDIF("6/12/1950","1/16/2015","y") formula in excel sheet, it gives 64. which is correct.
When I use the same in VBA.datediff("yyyy", dob, dos), it returns 65.
Pls advise How to get this solved. As this is required in VBA macro, I do not want to use the formula method.
Below is my part of vba code. dob and dos are in string format as input from other process.
Code:
Dim DOB, DOS As String
DOB = "06/12/1950"
DOS = "01/15/2015"
Debug.Print VBA.DateDiff("yyyy", VBA.CDate(DOB), VBA.CDate(DOS))
Regards,
Prasad DN
PS: I tried web search, all pointers leads to datediff function only