This section contains the detail about Date in PHP.
Date in PHP
In this tutorial you will learn how to used date function in a PHP web application. The date/time functions are part of the PHP core. There is no installation needed to use these functions. The date/time functions allow you to extract and format the date and time on the server.
In this tutorial used different date format function and 'date("d/m/Y h:i:s")' function return's date and time. In this tutorial use checkdate() that return true if date is valid another return's false. date("l") return's current day and 'date_default_timezone_get("void")' return's the default time zone. Example code given below :
<?php
echo "<b>Date:</b>". "<br />";
echo "date=>".date("Y/m/d") . "<br />";
echo "date=>".date("Y.m.d") . "<br />";
echo "date=>".date("Y-m-d")."<br />";
echo "<b>Date and Time:</b>". "<br />";
echo "date and time=>".date("d/m/Y h:i:s")."<br />";
echo "<b>Check Date:</b>". "<br />"."12,31,2000=>";
var_dump(checkdate(12,31,2000))."eeeeee";
echo "<br />"."2,29,2003=>";
var_dump(checkdate(2,29,2003));
echo "<br />"."2,29,2004=>";
var_dump(checkdate(2,29,2004));
echo "<br />";
echo "<b>Day:</b>". "<br />";
echo(date("l") . "<br />");
echo "<b>Default Timezone:</b>". "<br />";
echo(date_default_timezone_get("void"))."<br />";
?>
Output:-


[ 0 ] Comments