jaxdevil Posted April 21, 2008 Share Posted April 21, 2008 Below is my code. based on my servers time (which appears to be off by like 20 minutes) I set the following to say 'work time' when it is between 8:30AM and 5:00PM, and say 'not work time' when it is not those times. Any idea why it is displaying "work timenot work time" (both if statements)? <? if (date("Hi")>0410 and date("Hi")<1240); { ?>work time<? } ?> <? if (date("Hi")>1239 and date("Hi")<2400 or (date("Hi")>0000 and date("Hi")<0411)); { ?>not work time<? } ?> Link to comment https://forums.phpfreaks.com/topic/102198-solved-if-statements-cant-both-be-true/ Share on other sites More sharing options...
craygo Posted April 21, 2008 Share Posted April 21, 2008 Why check both <?php if (date("Hi")>0410 and date("Hi")<1240); { echo "Work Time"; } else { echo "not work time"; } ?> Unless you are going to check other times of the day for other things, it's either work time or not. Ray Link to comment https://forums.phpfreaks.com/topic/102198-solved-if-statements-cant-both-be-true/#findComment-523129 Share on other sites More sharing options...
jaxdevil Posted April 21, 2008 Author Share Posted April 21, 2008 Thanks! Link to comment https://forums.phpfreaks.com/topic/102198-solved-if-statements-cant-both-be-true/#findComment-523265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.