Date
Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given.Example:
<?php
$day1 = date("d");
$day2 = date("D");
$day3 = date("l");
echo $day1;
echo "<br />";
echo $day2;
echo "<br />";
echo $day3;
echo "<br />";
?>
//////////////////
//Output
//27 //date("d");
//Tue //date("D");
//Tuesday //date("l");
$day1 = date("d");
$day2 = date("D");
$day3 = date("l");
echo $day1;
echo "<br />";
echo $day2;
echo "<br />";
echo $day3;
echo "<br />";
?>
//////////////////
//Output
//27 //date("d");
//Tue //date("D");
//Tuesday //date("l");
PHP Date :: Month
<?php
$month1 = date("n");
$month2 = date("m");
$month3 = date("M");
$month4 = date("F");
$month5 = date("t");//Number of days
echo $month1;
echo "<br />";
echo $month2;
echo "<br />";
echo $month3;
echo "<br />";
echo $month4;
echo "<br />";
echo $month5;
echo "<br />";
////////////////
//Output
//7 //date("n");
//07 //date("m");
//Jul //date("M");
//July //date("F");
//31 //date("t");
?>
$month1 = date("n");
$month2 = date("m");
$month3 = date("M");
$month4 = date("F");
$month5 = date("t");//Number of days
echo $month1;
echo "<br />";
echo $month2;
echo "<br />";
echo $month3;
echo "<br />";
echo $month4;
echo "<br />";
echo $month5;
echo "<br />";
////////////////
//Output
//7 //date("n");
//07 //date("m");
//Jul //date("M");
//July //date("F");
//31 //date("t");
?>
PHP Date :: Year
<?php
$year1 = date("Y");
$year2 = date("y");
echo $year1;
echo "<br />";
echo $year2;
echo "<br />";
//////////////////
//Output:
//2010 //date("Y");
//10 //date("y");
?>
$year1 = date("Y");
$year2 = date("y");
echo $year1;
echo "<br />";
echo $year2;
echo "<br />";
//////////////////
//Output:
//2010 //date("Y");
//10 //date("y");
?>
PHP Date :: Examples
<?php
$format1 = date("c");
$format2 = date("r");
$format3 = date("m.d.y");
$format4 = date("F j, Y");
echo $format1;
echo "<br />";
echo $format2;
echo "<br />";
echo $format3;
echo "<br />";
echo $format4;
echo "<br />";
?>
//////////////////
//Output:
//2010-07-27T09:57:17-07:00 //date("c");
//Tue, 27 Jul 2010 09:57:17 -0700 //date("r");
//07.27.10 //date("m.d.y");
//July 27, 2010 //date("F j, Y");
?>
$format1 = date("c");
$format2 = date("r");
$format3 = date("m.d.y");
$format4 = date("F j, Y");
echo $format1;
echo "<br />";
echo $format2;
echo "<br />";
echo $format3;
echo "<br />";
echo $format4;
echo "<br />";
?>
//////////////////
//Output:
//2010-07-27T09:57:17-07:00 //date("c");
//Tue, 27 Jul 2010 09:57:17 -0700 //date("r");
//07.27.10 //date("m.d.y");
//July 27, 2010 //date("F j, Y");
?>
Comments
Add a Comment
Sponsors
Google Meta Tags Generator Online
Create your own meta tags using our free code generator.
BuzzBoost Css Generator Online
Free Google BuzzBoost CSS Style Generator Online
Text Ads Generator
Create Your Own HTML Ad Using Our Free HTML Editor
Link Style Generator
Free CSS Style Sheet Generator for Links