I am tasked with converting the old VB6 program to C #. One of the functions I had to deal with was calculating the date of birth from a file that was read from a binary file:
.BirthDate = CDate((CLng(recPatient.birthDateByte2) * 256) + (recPatient.birthDateByte1 + 366))
The only function I could find remotely similar:
DateTime BirthDate = DateTime.ToDateTime((long)recPatient.birthDateByte2) * 256) + (recPatient.birthDateByte1 + 366));
However, ToDateTime(long) just returns an InvalidCastException .
Now I can create the line manually, but I can not find any documentation anywhere on VB6 CDate(long) .
What am I doing wrong?
source share