Php date function returns a formatted date string. Every call to a date/time function will generate a E_NOTICE, E_STRICT or E_WARNING if the time zone is not valid.
d - The day of the month (01 to 31)
m -Month (01 to 12)
Y - Year (in four digits)
Syntax :
date(format,timestamp)
Example :
echo date("Y M d", time());
echo date("Y-M-d", time());
echo date("Y / M / d", time());
Output today formated date : 2007 Dec 24, 2007-Dec-24 and 2007 / Dec /24
To get the future date, i.e tommrow :
$tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
echo "Tomorrow is ".date("Y/m/d", $tomorrow);
Output : Tomorrow is 2007/12/25
To get a date in the past or future dynamically is like this:
//get timestamp for past/future date I want
$pf_time = strtotime("-3 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);
gmdate() - Format a GMT/UTC date/time
idate() - Format a local time/date as integer
getdate() - Get date/time information
getlastmod() - Gets time of last page modification
mktime() - Get Unix timestamp for a date
strftime() - Format a local time/date according to locale settings
time() - Return current Unix timestamp