Jump to content

write date range to table


proctk

Recommended Posts

Hi

I'm still scratching my head on this one. I'm trying to write the date to a table between a certain date range. 

below is what I'm trying to work with

[code=php:0]

$enddate = mktime(0, 0, 0, $endM, $endD, $endY);
$startdate = mktime(0, 0, 0, $StartM, $startD, $startY);
$d = $startdate - $enddate;

echo $nextdate.'<br>';
echo $startdate.'<br>';
echo $d;

switch ($eventRepeat){

case "daily":
echo "<tr><td class='right'>";
while($d < $i) {

echo "<tr><td>";
echo "$row[event_description]";
echo "</td><td>";
echo "$row[event_category]";
echo "</td><td>";
echo "$row[event_details]";
echo "</td></tr>";

    $i++;
    }
   
    break;
   
    default :

}
}
[/code]
Link to comment
Share on other sites

Think this one might need a more verbose explanation. I am struggling to work out what it is you are trying to achieve.

You are generating 2 timestamps based on a start date and end date.

you are the subtracting the enddate from the startdate giving you a negative? I suspect this should be the other way round to give you number of seconds between the start and end date? correct?

and then you lose me...
Link to comment
Share on other sites

ah right ok now i get you why not do this.....

get your starttime and endtime timestamps using mktime() like you are and then start a loop adding 86400 (seconds in a day) on each iteration until you get to your enddate?

If you are working with dates a lot you may want to check out [url=http://pear.php.net/manual/en/package.datetime.calendar.php]http://pear.php.net/manual/en/package.datetime.calendar.php[/url]
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.