
Displaying the time or date can be very important, depending on what sort of script you have. For example, if you have a forum script you will need a date stamp on it for your users. Displaying the time or date is also very easy in PHP, and there are lots of different ways of displaying the date.
The first way, is the best in my opinion. Use the code below to show something like Wednesday 1st of October 2008 10:28:47 PM
echo date('l jS \of F Y h:i:s A');
The next, will simply show the day.
echo date("l");
The next will show the time like this 22 34
echo date('G i');
And there are millions of combinations for this… Have a look at this page and it explains everything in detail. These are just a few examples.






































October 4th, 2008 at 4:19 am
A lot of times, a UNIX timestamp* is used to store a date, such as the date that a comment was posted. This time stamp can be generated using the time() function. You can convert the timestamp using the date() function above. Here’s an example:
echo date(’l jS \of F Y h:i:s A’,'1198609200′);
Normally, when you use the date function without the optional timestamp parameter, it defaults to the current output of time(). But if you include it, it will format the timestamp you provide.
*(A UNIX timestamp is simple. It’s the number of seconds since Jan 01 1970)
October 4th, 2008 at 4:35 am
There appears to be an error in my above code. It looks normal, but when copied and pasted into wordpad, the (’) are actually (`). Maybe the below code will get submitted correctly.
echo date(”l jS \of F Y h:i:s A”,”1198609200″);
December 8th, 2008 at 12:57 am
Sunday In searching for sites related to web hosting and specifically unix web hosting uk, your site came up.