List:General Discussion« Previous MessageNext Message »
From:Felix Geerinckx Date:September 27 2005 4:27pm
Subject:Re: linux timestamp
View as plain text  
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
Thread
linux timestampDotan Cohen27 Sep
  • Re: linux timestampFelix Geerinckx27 Sep
  • Re: linux timestampKeith Ivey27 Sep
  • Re: linux timestampNigel Wood27 Sep
    • Re: linux timestampDotan Cohen27 Sep