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'); } 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'); }?> 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')); } 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')); } 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')); } 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 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')); } Link to comment https://forums.phpfreaks.com/topic/73753-solved-time-question/#findComment-375009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.