p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   MySQL (http://p2p.wrox.com/forumdisplay.php?f=99)
-   -   QUERY TO extract data from database (http://p2p.wrox.com/showthread.php?t=87838)

internetpirate11 June 26th, 2012 12:28 AM

QUERY TO extract data from database
 
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??

rubansingh September 19th, 2012 05:30 AM

Thanks for the info you can find your answers here.. Php and Mysql with basic javascripts.
http://www.wiziq.com/course/5871-php...egrated-course[:)]

ciderpunx October 25th, 2012 05:05 PM

Quote:

Originally Posted by internetpirate11 (Post 284984)
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

internetpirate11 November 21st, 2012 04:15 AM

thank you....................


All times are GMT -4. The time now is 02:45 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.