On 27/09/2005, Dotan Cohen wrote:

> Hi all, I have a field in a mysql database v4.0.18 that contains a
> linux timestamp. I have been googleing for a solution that would
> return to me all the entries where the timestamp falls on, say a
> wednesday, or between 2pm to 3pm. 

SET @uts := UNIX_TIMESTAMP(NOW());

SELECT 
IF(WEEKDAY(FROM_UNIXTIME(@uts)) = 2, 'Yes', 'No') AS 'Wednesday?';

SELECT 
IF(TIME(FROM_UNIXTIME(@uts)) BETWEEN '14:00' AND '15:00', 'Yes', 'No')
AS 'Between 2 and 3 pm?';

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


-- 
felix

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

Reply via email to