Jump to content

best way to find what day of the week a day is on


smartalco

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...