Solved

MySQL select a row where datetime (epoch) over 20 minutes old

Posted on 2009-07-08
4
449 Views
Last Modified: 2012-05-07
Hi,
I have a column called datemade, it is stored in this type of format:
1238404018
Epoch?
What i want to do is only selct rows that are over 20 minutes old?

SELECT *
FROM salestable
WHERE datemade +??

Then I'm stuck

Any suggestions please????
0
Comment
Question by:tonypearce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:mallcore
ID: 24805753
SELECT *, from_unixtime(datemane)
FROM salestable

with this you will get time in normal format
0
 
LVL 5

Expert Comment

by:mallcore
ID: 24805774
SELECT *, from_unixtime(datemane)
FROM salestable
WHERE unix_timestamp('yourtime')


better version sorry
0
 
LVL 27

Accepted Solution

by:
Cornelia Yoder earned 500 total points
ID: 24805908
You can select the unix epoch date directly, or formatted into a standard datetime (from_unixtime(datemade)) .

You can get the 20 minutes from adding a WHERE clause to your query:

SELECT * FROM salestable
WHERE SUBDATE(unix_timestamp(NOW()), INTERVAL 20 MINUTE) > datemade
0
 

Author Closing Comment

by:tonypearce
ID: 31601213
Thanks very much, complete and accurate
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question