Solved

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

Posted on 2009-07-08
4
432 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
  • 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:
yodercm 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 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