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

  • Home
  • SEARCH
  • 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 3318914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:45:46+00:00 2026-05-17T22:45:46+00:00

Hay, i have a database holding events. There are 2 fields ‘start’ and ‘end’,

  • 0

Hay, i have a database holding events. There are 2 fields ‘start’ and ‘end’, these contain timestamps. When an admin enters these dates, they only have the ability to set the day,month,year. So we are only dealing with stamps containing days,months,years, not hours,minutes,seconds (hours,minutes and seconds are set to 0,0,0).

I have an event with the start time as 1262304000 and the end time as 1262908800. These convert to Jan 1 2010 and Jan 8 2010. How would i get all the days between these timestamps? I want to be able to return Jan 2 2010 (1262390400), Jan 3 2010 (1262476800) .. all the way to the end stamp. These events could cross over into different months, say May 28 to June 14.

Any ideas how to do this?

  • 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-05-17T22:45:46+00:00Added an answer on May 17, 2026 at 10:45 pm

    You just have to calculate the number of seconds between the two dates, then divide to get days :

    $numDays = abs($smallestTimestamp - $biggestTimestamp)/60/60/24;
    

    Then, you can use a for loop to retrieve the dates :

    $numDays = abs($smallestTimestamp - $biggestTimestamp)/60/60/24;
    
    for ($i = 1; $i < $numDays; $i++) {
        echo date('Y m d', strtotime("+{$i} day", $smallestTimestamp)) . '<br />';
    }
    

    Again, if you don’t know which timestamp is the smallest, you can use the min() function (second argument in strtotime).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hay I have a model like this def Photo(models.Model): # Photo object fields... def
hay, i have two textboxes i.e book_name and author and a button that save
Hay i have a model def Friends(models.Model): user = models.ManyToManyField(User) def User(models.Model): and i
Hay, I have some markup like this <div id=some-id> <h2><a href=#>Title</a></h2> </div> and some
Hay all, i have a basic big of jQuery. What I'm trying to do
Hay Everyone, i have a MySQL query SELECT * FROM `product` WHERE `price` BETWEEN
Hay all, i have a simple model like this def Article(models.Model): upvotes = models.ManyToManyField(User,
Hay, I have a table a products which has a 'cost_price' field. When a
Hay all, I am trying to validate a select in kohana 3.0 and I

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.