Jump to content

[SOLVED] Query to compare large numbers (unix timestamps) problem


sc_84

Recommended Posts

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

 

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.