Thursday, 11 October 2012

Date function in PHP

echo(“Result with date():”);
echo(date(“l”) . “”);
echo(date(“l dS \of F Y h:i:s A”) . “”);
echo(“Oct 3,1975 was on a “.date(“l”, mktime(0,0,0,10,3,1975)).””);
echo(date(DATE_RFC822) . “”);
echo(date(DATE_ATOM,mktime(0,0,0,10,3,1975)) . “”);


echo(“Result with gmdate():”);
echo(gmdate(“l”) . “”);
echo(gmdate(“l dS \of F Y h:i:s A”) . “”);
echo(“Oct 3,1975 was on a “.gmdate(“l”, mktime(0,0,0,10,3,1975)).””);
echo(gmdate(DATE_RFC822) . “”);
echo(gmdate(DATE_ATOM,mktime(0,0,0,10,3,1975)) . “”);


 


 


Output:


Result with date():
Tuesday
Tuesday 24th of January 2006 02:41:22 PM
Oct 3,1975 was on a Friday
Tue, 24 Jan 2006 14:41:22 CET
1975-10-03T00:00:00+0100


Result with gmdate():
Tuesday
Tuesday 24th of January 2006 01:41:22 PM
Oct 3,1975 was on a Thursday
Tue, 24 Jan 2006 13:41:22 GMT
1975-10-02T23:00:00+0000

No comments:

Post a Comment