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

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.