

(even though running datestr(0,'dd-mm-yyyy HH-MM-SS') reveals that the reference point is actually ).

The MATLAB documentation for datestr states The offset b expressed in days ( b/a) tells you that their "origin of time" is 367 days apart with your old value for b this came out to 281 days. You can probably avoid some rounding errors by putting in the precise value for a. MATLAB stores the date/time in units "days" (with time as fractional days) and C# stores time as "ticks", i.e. Returns, so your DateTime value is actually for May 2nd, not Feb 5th!! To calculate the correct values set cs_times = [('0 11:19:15').Ticks. Now on to the details, in case anyone is interested: You claim In summary, the function given in the question is off by 367-281=86 days and should be corrected to function cstime = datenum2datetime( matlabSerialTime )Ĭstime = 10^7*60*60*24*(matlabSerialTime - 367) Turns out that the example time points sharhar_m gives in the question are wrong (sorry for not checking that earlier). Edit: Surprised by jarr's answer I investigated further.
