MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Craig Hibbert Date:July 26 2004 10:24pm
Subject:Select statement inbetween unix timestamp ranges
View as plain text  
Hello,

 

I have been pulling my hair out trying to get a SELECT statement to work
using a range of Unix timestamps as the criteria.

 

MySQL Version 4.0

 

SELECT FROM_UNIXTIME(time) FROM srvlog WHERE FROM_UNIXTIME(time >=

'1080948600') AND FROM_UNIXTIME(time <= '1080997876');

 

I also tried this too:

 

SELECT FROM_UNIXTIME(time) FROM srvlog WHERE FROM_UNIXTIME(time >=

'1080948600' AND FROM_UNIXTIME(time <= '1080997876')); //Change the
parenthesis to make one evaluation. Same result.

 

 

This query returns all rows and does not stop at the '<=' parameter of
1080997876. Even when I get this working, how do I display the output in
the FROM _UNIXTIME(time, '%b %m %h:%m......etc)  so I can control the
way the date appears after the Unix time comparison has taken place?

 

The time field is int(11) and this works the same on Linux and Windows
so it is not an issue with the OS or the environment (unless I am
missing something simple). I have read the MySQL Date and Time page but
not quite found what I am looking for. Any help would be greatly
appreciated.

 

 

Many thanks,

 

 

Craig.

 

 


Thread
Select statement inbetween unix timestamp rangesCraig Hibbert27 Jul
  • Re: Select statement inbetween unix timestamp rangesKeith Ivey27 Jul