BLOG

Introduction to PHP Date

11th of January 2007
Tags:

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

Your email address will not be published. Required fields are marked *

  • About Us

    We are Voodoochilli Design Ltd - the place to go for Hereford web design

    We have been designing and building websites for over 10 years and have worked with a wide range of businesses from start-ups to multi-billion pound internationals and everything in between.

    If you are interested in finding out more, check out our full website.

  • Recent Posts