3. Date and Time

Most of the time, the date and time functionalities of PHP 5 are used for printing out the current date and time—to pretend that the Web page is up-to-date. (You would be surprised how many larger Web sites actually use this.) But apart from that, working with date and time in PHP offers many other possibilities, most of which you will find in this chapter. As of PHP version 5.2, the completely new DateTime extension was added to the PHP core. Of course, this does not affect existing functionality, which continues to work fine, but there are some new features, some of them also covered in this chapter.

First, though, it seems appropriate to take a look at the PHP function that is probably used the most for working with dates: ...

Get PHP and MySQL™ Phrasebook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.