Jump to content

Display Dates between from date to date


newphpbees

Recommended Posts

Hi...

 

Good day!

 

I have table that has a field from_date and to_date.

 

Now I just want to know if how can I display as table format the dates between from_date to_date.

 

Like this

 

from_date: 2011-12-16

to_date: 2011-12-31

 

I want to display it:

 

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 // table format.

 

Thank you

Link to comment
Share on other sites

<?php
$from_date = '2011-12-16'; // get your dates from your table into php variables
$to_date = '2011-12-31';

while($from_date <= $to_date){
echo $from_date . '<br />'; // produce and output what you want here...
$from_date = date('Y-m-d',strtotime("$from_date + 1 day")); // increment the date
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.