Jump to content

Recommended Posts

Hello all! I have a question that im sure has a obvious answer, but im stuck. Basically I need to populate a list of days from a span.

 

The user will pick a start date, like Mar 3 2009. Then an end date like Mar 10 2009. Then i need a list to populate from the days between. This example would give me 3, 4, 5, 6, 7, 8, 9, and 10. Obviously.

 

The problem im having is the month wrapping. For example, Mar 20 2009 - Apr 3 2009. How do i tell it how many days to make?

 

Im using MySql and Php, and populating the date via a javascript picker which stores the dates in a "Mar 03 2009" esque format in fields called `start_date` and `end_date`.

 

Thanks very much in Advance!

Link to comment
https://forums.phpfreaks.com/topic/147841-solved-days-apart/
Share on other sites

set up a few variables for the months and get an if month Mar = days 30

then from the day selected, subtract the day selected to the amount of days Mar has (info from the var = 30)

then add the result to the next month, again, get the info from another variable which stores how many days the next month has

and so on

Link to comment
https://forums.phpfreaks.com/topic/147841-solved-days-apart/#findComment-775964
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.