Getting the Current Date in PHP

phplogo.jpg

In this brief lesson we look at how we can obtain the current date in PHP.

There are several methods but the easiest is to just use the date() function with passed in parameters.

For example, we can use 'Y-m-d' to represent the Year, month and day:

The output will be:

If you would like to learn more about PHP then enrol in the PHP for Beginners course.