monkeybidz Posted October 18, 2007 Share Posted October 18, 2007 I am using this for time and date: $tiempo = date('l dS \of F Y h:i:s A',strtotime('tomorrow')); How would i do this: If current server time is after 12pm or $miles above 100 $tiempo = date('l dS \of F Y h:i:s A',strtotime('tomorrow')); else $tiempo = date('l dS \of F Y h:i:s A'); Can someone translate this to code? It's the "after 12pm part that i am having trouble with. if(date('h') > 12pm || $miles >=100){ $tiempo = date('l dS \of F Y h:i:s A',strtotime('tomorrow')); }else{ $tiempo = date('l dS \of F Y h:i:s A'); } Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/ Share on other sites More sharing options...
darkfreaks Posted October 18, 2007 Share Posted October 18, 2007 <?php /// if date hours is greater than 12pm and and miles is greater than 100 if(date('h') > 12|| $miles >=100){ $tiempo = date('l dS \of F Y h:i:s A',strtotime('tomorrow')); }else{ $tiempo = date('l dS \of F Y h:i:s A'); }?> Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-372134 Share on other sites More sharing options...
monkeybidz Posted October 21, 2007 Author Share Posted October 21, 2007 Works great! Is there a way to also ask: if(date('what goes here') == Saturday){ $tiempo = date('l dS \of F Y h:i:s A',strtotime('+48')); } Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-374905 Share on other sites More sharing options...
only one Posted October 21, 2007 Share Posted October 21, 2007 Yes, if(date("l") == saturday) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+48')); } Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-374909 Share on other sites More sharing options...
monkeybidz Posted October 21, 2007 Author Share Posted October 21, 2007 I get 1969 date with that. I also tried: if(date('w')==6) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+48')); } AND if(date('L')==SATURDAY) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+48')); } Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-374917 Share on other sites More sharing options...
only one Posted October 21, 2007 Share Posted October 21, 2007 You have too use a small L this one: if(date('L')==SATURDAY) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+48')); } http://php.net/date Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-374924 Share on other sites More sharing options...
monkeybidz Posted October 21, 2007 Author Share Posted October 21, 2007 Here it goes: if(date('l')==Saturday) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+2 days')); } Quote Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-375009 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.