master82 Posted January 21, 2007 Share Posted January 21, 2007 Is it possible to create an IF function where the true/false value is determined by the time?Im hoping to add a link that can only be seen during the last 5 mins of each hour... is it possible and if so, how? lol Quote Link to comment Share on other sites More sharing options...
AndyB Posted January 21, 2007 Share Posted January 21, 2007 http://ca.php.net/manual/en/function.date.php - date("i") gives current time minutes 00-59Something like this ...[code]if (date("i")>54) { echo "link here";}[/code] Quote Link to comment Share on other sites More sharing options...
master82 Posted January 21, 2007 Author Share Posted January 21, 2007 Thank You! :) Quote Link to comment Share on other sites More sharing options...
master82 Posted February 5, 2007 Author Share Posted February 5, 2007 Actually can I take this a liitle further...if (date("i")>54) { echo "link here";}What would be the changes needed so that I can see the true value if the time is between 23:55 and 00:05just a quick guess...if (date("H")>22 AND date("i")>54 AND date("H")<01 AND date("i")<05) { echo "link here";} Quote Link to comment Share on other sites More sharing options...
paul2463 Posted February 5, 2007 Share Posted February 5, 2007 you would need some more brackets to seperate the two cases such as:[code]<?phpif ((date("H")>22 AND date("i")>54) AND (date("H")<01 AND date("i")<05)) { echo "link here";}?>[/code] Quote Link to comment Share on other sites More sharing options...
master82 Posted February 5, 2007 Author Share Posted February 5, 2007 Thank you! 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.