From: Martien van Bussel on
I've been trying to read filetimes from a My-SQL database into Matlab, i.e. convert them to a Matlab serial date number. And I'm not very succesful at it.

There's a function to perform (part of) this action called "FileTimeToSystemTime" in the windows API (kernel32.dll). There's also a DateTime.FromFileTime() method in .net. However, I don't think I can reach those from Matlab (Or can I?).

Calculating the whole thing manually seems way to complicated to do such a trivial thing. That would also provide issues with 64bit operations in Matlab (not many are supported) and leap years / seconds / etc.

BTW: the filetime structure contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

Suggestions are really welcome!

Kind regards, Martien
From: TideMan on
On Feb 11, 4:54 am, "Martien van Bussel"
<busse...(a)kempenhaeghe.removethispart.nl> wrote:
> I've been trying to read filetimes from a My-SQL database into Matlab, i.e. convert them to a Matlab serial date number. And I'm not very succesful at it.
>
> There's a function to perform (part of) this action called "FileTimeToSystemTime" in the windows API (kernel32.dll). There's also a DateTime.FromFileTime() method in .net. However, I don't think I can reach those from Matlab (Or can I?).
>
> Calculating the whole thing manually seems way to complicated to do such a trivial thing. That would also provide issues with 64bit operations in Matlab (not many are supported) and leap years / seconds / etc.
>
> BTW: the filetime structure contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
>
> Suggestions are really welcome!
>
> Kind regards, Martien

You seem to be making things much more complicated than they really
are.
datenum is your friend.
What is the format of the date/times you are bringing into Matlab?
Whatever it is, you can specify it like this in datenum:
t=datenum(date_time_string_matrix_or_cell_array,'yyyymmdd HHMMSS');

From: Martien van Bussel on
TideMan <mulgor(a)gmail.com> wrote in message <1a35c2ca-04e7-46ba-8a73-7ff20a56919c(a)m24g2000prn.googlegroups.com>...
> You seem to be making things much more complicated than they really
> are.
> datenum is your friend.
> What is the format of the date/times you are bringing into Matlab?
> Whatever it is, you can specify it like this in datenum:
> t=datenum(date_time_string_matrix_or_cell_array,'yyyymmdd HHMMSS');

Yes. That would have made things easy. However Matlab doesn't accept a 64bit FILETIME variable as input for datenum.

Thanks for your suggestion, though.