• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

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

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
Tony Pearce
Asked:
Tony Pearce
  • 2
1 Solution
 
mallcoreCommented:
SELECT *, from_unixtime(datemane)
FROM salestable

with this you will get time in normal format
0
 
mallcoreCommented:
SELECT *, from_unixtime(datemane)
FROM salestable
WHERE unix_timestamp('yourtime')


better version sorry
0
 
Cornelia YoderArtistCommented:
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
 
Tony PearceAuthor Commented:
Thanks very much, complete and accurate
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now