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 6002785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:01:42+00:00 2026-05-23T01:01:42+00:00

Okay say I have two timestamps saved in database in the format yyyymmdd, a

  • 0

Okay say I have two timestamps saved in database in the format yyyymmdd, a start date and end date.

say these are my start and end dates: 20110618-20110630

How could i make it echo 20110618, 20110619, 20110620 etc all the way to 20110630?

  • 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-23T01:01:43+00:00Added an answer on May 23, 2026 at 1:01 am
    // Will return the number of days between the two dates passed in
    function count_days( $a, $b ) {
        // First we need to break these dates into their constituent parts:
        $gd_a = getdate( $a );
        $gd_b = getdate( $b );
    
        // Now recreate these timestamps, based upon noon on each day
        // The specific time doesn't matter but it must be the same each day
        $a_new = mktime( 12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year'] );
        $b_new = mktime( 12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year'] );
    
        // Subtract these two numbers and divide by the number of seconds in a
        //  day. Round the result since crossing over a daylight savings time
        //  barrier will cause this time to be off by an hour or two.
        return round( abs( $a_new - $b_new ) / 86400 );
    }
    
    // Prepare a few dates
    $date1 = strtotime( '20110618' );
    $date2 = strtotime( '20110630' );
    
    // Calculate the differences, they should be 43 & 11353
    echo "<p>There are ", count_days( $date1, $date2 ), " days.</p>\n";
    $days = count_days($date1, $date2);
    for ($i = 0; $i < $days; $i++) {
        echo date('Ymd', $date1+(86400*$i));
    }
    

    Using function from: Get number of days between two dates.

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

Sidebar

Related Questions

Okay, so let's say I have a mysql database table with two columns, one
Okay, so let's say I have a class file called Orange, and then two
Start with these simple classes... Let's say I have a simple set of classes
Okay say I have a function like below: -(NSNumber *)calculate{ NSNumber *myNum = [[[NSNumber
Okay, let's say we have a class defined like public class TestClass { private
Say I have two lists or arrays of strings. For example: list 1: a,
Okay lets say I have a list, and I want to check if that
Okay. Say I have string '193' And I want to remove the last numbers
Okay, i have this question in one regarding threads. there are two unsynchronized threads
Okay so let's say I have a folder and in a folder I have

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.