PHP date function



The PHP date() function formats a timestamp to a more readable date and time. But, what is a timestamp?



A timestamp is the number of seconds from January 1, 1970 at 00:00. Otherwise known as the Unix Timestamp, this measurement is a widely used standard that PHP has chosen to utilize.

The required format parameter in the date() function specifies how to format the date/time.

* d - Represents the day of the month (01 to 31)
* m - Represents a month (01 to 12)
* Y - Represents a year (in four digits)


<?php
echo date("Y/m/d") . "<br />";
echo 
date("Y.m.d") . "<br />";
echo 
date("Y-m-d")
?> 

2010/04/04
2010.04.04
2010-04-04