Home

See the related posts

PHP Warning: Call-time pass-by-reference has been deprecated    Working with Database (MySQL)    Cookies in PHP    Session Management Functions in php    Join array elements with a string – implode   

Finding the day of the week for a specific date using PHP

It will be very usefull if provide the day of the week, along with the date. So that we can easily identify the weekend days and plan accordingly.The following script will give you option to display the day in your code.

	<?php
	//This will return the day of the week in a 3 letter textual format (i.e. Sun, Mon, etc...)
	echo date("D",mktime()); // For current date

	//This will return the day of the week in full textual format (i.e. Sunday, Monday, etc...)
	echo date("l",mktime()); // For current date

	//This will return the day of the week in numerical format (i.e. "0" Sunday to "6" Saturday)
	echo date("l",mktime()); // For current date

	$month="1"; // Month of your choice . eg 1 for january

	$date="1";  // Date of your choice, eg; 12

	$year="2010"  // Year of your choice

	$day_of_week=date("D",mktime(0,0,0,$month,$date,$year));

	echo $day_of_week; This will display the day of the week for the given   time
echo "<a href='http://samplephpcodes.com'>Sample PHP Codes</a>";
	?>
	

Home

See the related posts

PHP Warning: Call-time pass-by-reference has been deprecated    Working with Database (MySQL)    Cookies in PHP    Session Management Functions in php    Join array elements with a string – implode   

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment