smartalco Posted July 19, 2007 Share Posted July 19, 2007 what would be the best way to, given a date, know what day of the week it was on?, my only thought was to basically count the days after the current in a variety of ways, any suggestions? Link to comment Share on other sites More sharing options...
jesh Posted July 19, 2007 Share Posted July 19, 2007 You might check the manual:http://us.php.net/dateThere's a format parameter that will tell the processor to return either a numerical value for the day of the week ("N") or return the text representation for the day ("l"). echo date("N");echo date("l"); Link to comment Share on other sites More sharing options...
justsomeguy Posted July 19, 2007 Share Posted July 19, 2007 I like using getdate and mktime. You can get an array of values using this: $date_info = getdate(mktime($hour, $minute, $second, $month, $day, $year));switch ($date_info['wday']){ case 0: echo "Sunday"; break; case 1: echo "Monday"; break; case 2: echo "Tuesday"; break; case 3: echo "Wednesday"; break; case 4: echo "Thursday"; break; case 5: echo "Friday"; break; case 6: echo "Saturday"; break;} Look at the references for getdate and mktime for more info. Link to comment Share on other sites More sharing options...
smartalco Posted July 20, 2007 Author Share Posted July 20, 2007 thanks, i will look into that Link to comment Share on other sites More sharing options...
jhecht Posted July 20, 2007 Share Posted July 20, 2007 I'm with Jesh, i use date() and time(), however i do use mktime every so often(just not alot). to me getdate() just is more work than i really have to do. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.