Jump to content

date overlap


flemingmike

Recommended Posts

hello all,

 

i have 2 fields in a table.  one as startdate and one as enddate.  i was wondering if there is a way to make a table with all the dates from start to end as the column headers.  then i want to check the table to see if there are any other entries that exist within those dates. and make a new row under with a Y in the cell that it exists in.

 

any direction/help is much appreciated.

 

thanks,

mike

Link to comment
https://forums.phpfreaks.com/topic/236770-date-overlap/
Share on other sites

problem 1:

 

field 1 - id

field 2 - start date

field 3 - end date

 

example data

field 1 - 22

field 2 - 2011-05-12

field 3 - 2011-05-16

 

 

im trying to figure out how to populate all dates between field 2 and field 3 and have them as the column header in a table.  maybe something like:

 

echo "<table border='0' style='border-collapse: collapse' bordercolorlight='#000000' bordercolordark='#000000' width='90%' align='center'>";

echo "<tr>
<th>2011-05-12</th>
<th>2011-05-13</th>
<th>2011-05-14</th>
<th>2011-05-15</th>
<th>2011-05-16</th>
</tr>";

Link to comment
https://forums.phpfreaks.com/topic/236770-date-overlap/#findComment-1217118
Share on other sites

If there are lots of rows in the table like

field 2 - 2011-05-12  field 3 - 2011-05-16

field 2 - 2010-07-12  field 3 - 2012-05-16

field 2 - 2009-05-12  field 3 - 2009-05-16

 

Then you are going to have to find the lowest date and the highest date and have a web page with all the dates in between. is this what you have in mind? you can find the lowest and highest no problem.

 

Desmond.

 

Link to comment
https://forums.phpfreaks.com/topic/236770-date-overlap/#findComment-1217122
Share on other sites

hmm..  what im trying to do is have people check in with there start and end dates.  at the end i want someone to be able to query to see if anybody else will be checked in on overlapping dates.  so if im checked in from may 5-10, and you are checked in may 7-12, i want that to show up in the query so i can see that you and i will be checked in between may 7-10.

 

is that possible?

Link to comment
https://forums.phpfreaks.com/topic/236770-date-overlap/#findComment-1217152
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.