Re: Getting wrong date ??
It is just a guess since we don't know what database you are using, but dates are usually stored as a double precision number with the date represented as an offset by the whole number since January 1, 1900, and the time is the decimal portion as the number of seconds since midnight. The error you are seeing is probably due to a round off as the double precision number is converted to a whole number.
J.A. Coutts
Re: Getting wrong date ??
Good point couttsj.
Probably adding an Int() will then fix it.
MyDate = CDate(Int(WkStart))
Re: Getting wrong date ??
I don't think an integer will handle it in this case, as anything over 32767 will be interpreted as a negative number.
This is how a date is stored:
Debug.Print CDbl(CDate("11/15/2017 8:42:32 PM"))
43054.8628703704
This is how it is interpreted as a long:
Debug.Print CLng(CDate("11/15/2017 8:42:32 PM"))
43055
And this is what you get using Fix:
Debug.Print CLng(Fix(CDate("11/15/2017 8:42:32 PM")))
43054
J.A. Coutts