This tutorial is about three points to get the formatted date and time. Handles UNIX timestamps. Gets the date and time information. The calculation of the date. Validates the validity of the date.
PHP Tutorial Processing date and Time (PHP beginner tutorial)
/*
This tutorial is about three points as follows
Gets the date and time that was formatted.
Handles UNIX timestamps.
Gets the date and time information.
The calculation of the date.
Validates the validity of the date.
*/
Gets the formatted date and time
echo " formatting the current time
";
echo Date (' y-m-j ');
echo "
";
echo "
";
echo "Today is the first of the Year". Date (' Z '). " Days ";
echo "
";
echo "
";
echo Date (' m web effect, y l ');
echo "
";
echo "
";
echo "Program execution Time:". Date (' h:i:s ');
Handles UNIX timestamps.
echo "Timestamp". Mktime (0,0,0,12,31,2007). " The corresponding date is: ";
echo "
";
echo Date ("M-d-y", Mktime (0,0,0,12,31,2007));
echo "";
echo "
";
$day = 1;
echo "Timestamp". Mktime (0,0,0,7, $day +38,2008). " The corresponding dates are:
";
echo Date ("Y-m-d", Mktime (0,0,0,7, $day +38,2008));
echo "";
Gets the date and time information.
$time = Mktime (20,0,0,8,8,2008);
echo " Date:". Date ("Y-m-d h:i:s", $time)."";
echo "
";
echo "
";
echo "The date related information is as follows:";
echo "
";$date = getdate ($time);
Print_r ($date);
The calculation of the date.
$day = 1;
$month = 10;
$year = 1949;
$national _unix = Mktime (0,0,0, $month, $day, $year);
$now _unix = time ();
$national _time = $now _unix-$national _unix;
$national _day_year = Floor ($national _time/(365*24*60*60));
$national _day_day = Floor ($national _time/(24*60*60));
echo "www.bKjia.c0m 2008 already ". $national _day_year. " Years ";
echo "";
echo "2008 already ". $national _day_day. " Days
Validates the validity of the date.
if (Checkdate (9,28,1980))
{
echo "7,22,1978:". " This is a correct date format ";
}
Else
{
echo "This is not a correct date format";
}
echo "
";
echo "";
echo "
";
if (Checkdate (9,99,1999))
{
echo "This is a correct date format";
}
Else
{
echo "9,99,1999:". " This is not a correct date format ";
}
/*
In this tutorial is mainly about the PHP date and time of the basic tutorial Oh, for beginners php very useful.
*/
?>
http://www.bkjia.com/PHPjc/631363.html www.bkjia.com true http://www.bkjia.com/PHPjc/631363.html techarticle This tutorial is about three points to get the formatted date and time. Handles UNIX timestamps. Gets the date and time information. The calculation of the date. Validates the validity of the date. PHP Tutorial Processing ...