Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:38:35+00:00 2026-06-04T00:38:35+00:00

I have a table with the following fields: id – int name – int

  • 0

I have a table with the following fields:

id - int
name - int
the_date - int

the_date is a unix timestamp for when the row was added

Now I am trying to write a query that will select all rows on the day that is 7 days from now. I’m not talking about select the rows >= 7 days from time(), I need to grab the current day using time(), and then run a SELECT that grabs all the rows that were inserted on the day that is 7 days from the time().

I know how to do it so its within 7 days from the time() with a simple >= SELECT, but I don’t know how to do it so it selects all rows whose unix timestamp is on that particular day (7 days from now).

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:38:37+00:00Added an answer on June 4, 2026 at 12:38 am

    The points of intrest here,

    • i use curdate() to get the current DATE, not DATETIME.
    • i add 7 days and convert to unix time, which yields the starting second of that day
    • i do the same for the next day
    • i structure the where clause to be >= or equal to the target day, but < the start of the next day. This gives a range of seconds that fully covers the target day.
    • i dont use any functions on the column itself. This is important because if i did, mysql wouldn’t be abl;e to use any indexes that exist on the column to fullfill the query.

    where the_date >= unix_timestamp(curdate() + interval 7 day)
      and the_date < unix_timestamp(curdate() + interval 8 day)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with the following fields: id amount_sale the_date (unix timestamp integer)
I have a table with following fields id (int) name (varchar) dob (datetime) Now
I have a database table tblDetails with following fields: itemID(int)(primary), itemCode(varchar), itemName(varchar),itemDescription(varchar) Now this
I have a table called Employee with the following fields: EmpID Salary Name I
I have a table in db2 which has the following fields int xyz; string
I have a table called employee with following fields Id | Name | PrimaryEmail1
In my database table I have the following fields: Table Supplier: id name vehicles
Hi I have a mysql table having the following fields A INT, B INT,
I have a table USERS with the following fields date(datetime) email(varchar) provider(int) event(int) I
I have a table with the following fields: email - name - username -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.