sc_84 Posted February 18, 2009 Share Posted February 18, 2009 Hello, I have a database which stores the time stamp of a particular record (the timestamp is made by php) so my db looks like this: TABLE payment_timestamp = 1261440000 I want to drag out all records which appear after 01 January 2000 (the time stamp for this is 946684800). So i run this query: SELECT * FROM accounts WHERE payment_timestamp > '946684800'; This returns an empty result set even though 1261440000 is larger than 946684800. The only thing I can find that as soon as the timestamp becomes the same amount of digits which is 10 it works. It only seems to not work when I compare a 9 digit number to a ten digit number (even though a ten digit number is greater than the 9 digit number obviously). Any help greatly appreciated Thanks Quote Link to comment https://forums.phpfreaks.com/topic/145800-solved-query-to-compare-large-numbers-unix-timestamps-problem/ Share on other sites More sharing options...
sc_84 Posted February 18, 2009 Author Share Posted February 18, 2009 Just an update if I add a 0 in front of the 9 digit number to make it 0946684800 (a 10 digit number) then it works. So it must be something to do with the fact im comparing a 9 digit number to a 10 digit number. Anyone come across this before ? adding a 0 infront is a bit of a hack i dont really want to do it this way, id prefer it to work properly? Quote Link to comment https://forums.phpfreaks.com/topic/145800-solved-query-to-compare-large-numbers-unix-timestamps-problem/#findComment-765513 Share on other sites More sharing options...
sc_84 Posted February 18, 2009 Author Share Posted February 18, 2009 LAST UPDATE: Just seen the problem the field wasnt an Integer field for some reason, its working now, so its becasue i was using the wrong field type Quote Link to comment https://forums.phpfreaks.com/topic/145800-solved-query-to-compare-large-numbers-unix-timestamps-problem/#findComment-765526 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.