maxso Posted December 5, 2008 Share Posted December 5, 2008 i need a script along the lines of... If the time is between two times (variable) then i need to include a script. If anyone can help or give any links to help me it would be appriechiated. Quote Link to comment Share on other sites More sharing options...
Brian W Posted December 5, 2008 Share Posted December 5, 2008 <?php $time = date('G'); if($time > 4 && $time < 6) { $BLAH_BLAH_BLAH } ?> $time will be 0-23 according to http://us2.php.net/date... best of luck Quote Link to comment Share on other sites More sharing options...
premiso Posted December 5, 2008 Share Posted December 5, 2008 <?php $time1 = strtotime('10/27/2008'); $time2 = strtotime('12/6/2008'); $newtime = time(); if ($time1 < $newtime && $time2 > $newtime) { include('script.php'); } ?> Quote Link to comment Share on other sites More sharing options...
maxso Posted December 5, 2008 Author Share Posted December 5, 2008 tyvm both of you. Quote Link to comment Share on other sites More sharing options...
maxso Posted December 5, 2008 Author Share Posted December 5, 2008 For brian's script, will it still work with... if($time > 4:30 && $time < 4:40) { Quote Link to comment Share on other sites More sharing options...
maxso Posted December 5, 2008 Author Share Posted December 5, 2008 bump Quote Link to comment Share on other sites More sharing options...
premiso Posted December 5, 2008 Share Posted December 5, 2008 You would have to encapsulate it in quotes if it will work or else syntax error. Here is my version that should work with what you want: <?php $time1 = strtotime('4:00 PM'); $time2 = strtotime('4:30 PM'); $newtime = time(); if ($time1 < $newtime && $time2 > $newtime) { include('script.php'); } ?> Unsure if the strtotime will return right, but yea. Quote Link to comment Share on other sites More sharing options...
maxso Posted December 5, 2008 Author Share Posted December 5, 2008 Thanks for your time. Ill put this as solved for now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.