Solarpitch Posted July 1, 2008 Share Posted July 1, 2008 Hi, Is this how you would check if today was Sunday for example... Only, I'm trying this but noting will print to screen as I'm testing. <?php $d=date("D"); if ($d=="Sun") { echo "Today is Sunday"; } ?> Link to comment https://forums.phpfreaks.com/topic/112740-checking-todays-day/ Share on other sites More sharing options...
mmarif4u Posted July 1, 2008 Share Posted July 1, 2008 There are many ways to do that. A simple way,added in PHP 5.1.0 $d=date(N); if ($d=="2") { echo "Today is Tuesday"; } 1 for monday 2 for tuesday 3 for wednesday 4 for thursday 5 for friday 6 for saturday 7 for sunday Link to comment https://forums.phpfreaks.com/topic/112740-checking-todays-day/#findComment-579004 Share on other sites More sharing options...
Solarpitch Posted July 1, 2008 Author Share Posted July 1, 2008 Is there anyway it could take the value of a date in the format 07012008 (today's date) and then check to see if today is Sunday? Link to comment https://forums.phpfreaks.com/topic/112740-checking-todays-day/#findComment-579016 Share on other sites More sharing options...
papaface Posted July 1, 2008 Share Posted July 1, 2008 <?php $date = date("N",mktime(0, 0, 0, 7, 1, 2008)); echo $date; ?> Link to comment https://forums.phpfreaks.com/topic/112740-checking-todays-day/#findComment-579020 Share on other sites More sharing options...
papaface Posted July 1, 2008 Share Posted July 1, 2008 or echo "Today is: " . date("l",mktime(0, 0, 0, 7, 1, 2008)); Link to comment https://forums.phpfreaks.com/topic/112740-checking-todays-day/#findComment-579023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.