Chapter 20. Managing the Date and Time

In this chapter, we discuss checking and formatting the date and time and converting between date formats. These capabilities are especially important when you are converting between MySQL and PHP date formats, Unix and PHP date formats, and dates entered by the user in an HTML form.

Key topics covered in this chapter include

  • Getting the date and time in PHP

  • Converting between PHP and MySQL date formats

  • Calculating dates

  • Using the calendar functions

Getting the Date and Time from PHP

Way back in Chapter 1, “PHP Crash Course,” we described using the date() function to get and format the date and time from PHP. Here, we discuss this function and some of PHP's other date and time functions in a little more detail. ...

Get PHP and MySQL Web Development, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.