karimali831 Posted August 10, 2010 Share Posted August 10, 2010 Hi! The below dropdown will show dates/times every 15 minutes from 12am to 11:45pm for only 1 day. I want it to show for 5 days, anyway I can do this? Below code: $start = strtotime('12:00am'); $end = strtotime('11:45pm'); echo '<select name="time">'; for ($i = $start; $i <= $end; $i += 900) { echo '<option>' . date('F j, Y, \a\t g:i a', $i); } echo '</select>'; Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/210333-php-datetime/ Share on other sites More sharing options...
AbraCadaver Posted August 10, 2010 Share Posted August 10, 2010 $end = strtotime('11:45pm +5 days'); Link to comment https://forums.phpfreaks.com/topic/210333-php-datetime/#findComment-1097615 Share on other sites More sharing options...
MadTechie Posted August 10, 2010 Share Posted August 10, 2010 LOL@ $end = strtotime('11:45pm +5 days'); Just do another loop of 5 ie echo '<select name="time">'; for ($d = 0; $d < 5; $d++){ $start = strtotime('12:00am'); $end = strtotime('11:45pm'); for ($i = $start; $i <= $end; $i += 900){ echo '<option>' . date('F j, Y, \a\t g:i a', $i+($d*24*60*60)); } } echo '</select>'; Link to comment https://forums.phpfreaks.com/topic/210333-php-datetime/#findComment-1097616 Share on other sites More sharing options...
AbraCadaver Posted August 10, 2010 Share Posted August 10, 2010 LOL@ $end = strtotime('11:45pm +5 days'); Why is that funny? Better than doing another loop. Link to comment https://forums.phpfreaks.com/topic/210333-php-datetime/#findComment-1097619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.