Jump to content

[SOLVED] Days Apart


seventheyejosh

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.