I thought for this blog item I would write about something fairly simple, that should help a lot of people. PHP has a very useful built in function simply called date(). Guess what it does? That’s right it returns the current date, but it can be used with other functions to do much more.
Here is a very simple example of its usage:
echo date(”F j, Y, g:i a”);
This will print out the today’s date in this format:
Month, Day, Year, Hour, Minutes and AM or PM
If you simply wanted to show the time and not the full date you would use:
echo date(”g:i a”);
For a more detail on using the PHP date() function visit www.php.net/date
Leave a Reply