OLE Automation Date conversion
am 25.05.2007 15:26:55 von IsraelI have a database with many datetime columns that are stored as
floating point numbers that represent the number of days since Jan 01,
1900 - or I guess it's really since Jan 00, 1900. This was done
because the datetime field in MySQL had a precision of only 1 second
and we needed fractional seconds - I'm not sure if this constraint is
still true.
Currently we don't have time to write any frontend applications to
query the database so I want to make it easier for people to filter
the data without having to convert to/from a number.
What I'm looking for is some type of MySQL conversion function to do
the following:
SELECT * FROM mytable WHERE timestamp > ConvertToNumber("2007/5/25
1:23 PM")
SELECT ConvertToDateTime(timestamp), someothercolumn, FROM mytable
The only related methods I could find where CAST() and CONVERT() but I
couldn't find any way to use them to produce the results I wanted.