Jump to content

Time subtraction


jpratt

Recommended Posts

I have two timestamps comming in from a mysql database. For my testing Im using the following stamps:

 

2007-12-17 15:30:00

2007-12-17 17:00:00

 

My page needs to display a select box with the values between the stamps every half an hour. so in this instance it should loop and display the following values in the box:

 

3:30 pm

4:00 pm

4:30 pm

 

I have played with the following without luck:

 

while ($stime != $etime) {
echo "<option value='" . $stime . "'>" . date("g:i a", strtotime($stime)) . "</option>";
$stime = date("i", strtotime($stime)) + 30;
}

 

The ideo is to loop through until the start and end stamps match. Any idea on how to do this?

Link to comment
https://forums.phpfreaks.com/topic/106112-time-subtraction/
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.