Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxxAPC, How to unsubscrube from dategen spam, WWWXXXAPC, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text, how to setup procmail html2text

Links

XODOX
Impressum

#1: OLE Automation Date conversion

Posted on 2007-05-25 15:26:55 by Israel

I 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.

Report this message