Quote:
Originally Posted by internetpirate11
ok i have data stored in my database field is datetime/timestamp.
so what i want is, i want data to be displayed which is older than 24 hours only.
SO how could i write query for that??
|
Code:
SELECT * FROM table WHERE datetime <(UNIX_TIMESTAMP(NOW()) - 24*60*60);
A UNIX timestamp is a count of seconds since 1 Jan 1970 24*60*60 is the number of seconds in 24 hours.
You can also write (IIRC):
Code:
WHERE datediff(hh, datetime, NOW()) < 24