Current course:

PHP date


PHP's "date" allows you to use the current day, month, year, second, millisecond...etc for purposes of display, comparison, and much more. It retreives the SERVERs date, not the local machine's date, so even if the users computer has the wrong date/time, it will still get the correct time.

One downside is, if the user is in a different timezone, the time will appear incorrect.

You can retreive the date in MANY different formats - you can get the day of the week (Monday or Mon.), as well as the name of the month, an abbreviated name of the month, and more.


<? $date = date('Y-m-d'); echo $date; ?>

More in depth:

For a more in depth explanation as well as different date formats, visit's Date page.