Query related
Moderator: General Moderators
Query related
Hi,
How to find the values of exactly one day old data from curtime()
Suppose time() is 12:40:56 to find data between time() and previous day 12:40:56.
How to find the values of exactly one day old data from curtime()
Suppose time() is 12:40:56 to find data between time() and previous day 12:40:56.
I used the queryfeyd wrote:Subtract a day from that time. It's generally held that there are 24 hours in a day, 60 minutes in a hour and 60 seconds in a minute.
select * from `table_name` where `fieldname` < now() and `fieldname` > now()-interval 1 day
But I am not getting exactly 24hours data.
I am getting the data from cur timestamp till previous day data till 2007-09-13 00:00:00
How to get exactly 24 hours data from current timestamp
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
It is possible if the query is in a php script. If it is not, then ignore me.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
I think Canada has 10 deca-ehs in a day with 100 milli-ehs in a deca-eh. That's because a Canuck can polish off a two-four faster those hexa hosers.feyd wrote:True, that would be 3 hexahours a day, 48 decaminutes per hexahour, and 60 decaseconds per decaminute.Kieran Huggins wrote:Not in Canada, we're on metric time.
(#10850)
sandy1028 wrote:
select * from `table_name` where `fieldname` < now() and `fieldname` > now()-interval 1 day
But I am not getting exactly 24hours data.
I am getting the data from cur timestamp till previous day data till 2007-09-13 00:00:00
How to get exactly 24 hours data from current timestamp
It could be because you're using a bit of a non-standard way of doing your time manips.
Code: Select all
select * from table where field <= now() and field> date_sub(now(),interval 1 day)