[EMAIL PROTECTED] wrote:
Hello mysql,

I have a PHP script that I have written and it runs beautifully on
current MySQL and PHP sites BUT, it barfs on MySQL 4.0 because I am
using the DATE() to extract the Date from a timestamp. Does anyone
remember how to do an equivalent function in 4.0? I have searched
through hundreds of pages and can not find anything that looks like it
might work. Essentially I need to extract the YYYY-MM-DD from a
timestamp field that I populated in a PHP script so I can do a diff
against a current timestamp.

Here is the query that works on current and falls over dead on 4.0:

"SELECT count(SimulatedTimeSet) as count_live FROM `Simulator`
WHERE DATE( `SimulatedTimeSet` ) = DATE(CURRENT_TIMESTAMP)"

Try FROM_UNIXTIME().

Have you read the manual section on date and time functions? There are quite a few. You don't need to read hundreds of pages.

http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html

Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to