PHP and MySQL Web Development - P82: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Next 377 Next We ll move on to Chapter 18 Managing the Date and Time and look at PHP s libraries of date and calendar ll see how to convert from user-entered formats to PHP formats to MySQL formats and back again. 18 Managing the Date and Time In THIS CHAPTER WE LL discuss CHECKING and formatting the date and time and converting between date is especially important when converting between MysQL and PHP date formats Unix and PHP date formats and dates entered by the user in an HTML form. We ll cover 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 talked about using the date function to get and format the date and time from PHP We ll talk about it and some of PHP s other date and time functions in a little more detail now. Using the date Function As you might recall the date function takes two parameters one of them optional. The first one is a format string and the second optional one is a UNIX time stamp. If you don t specify a time stamp then date will default to the current date and time. It returns a formatted string representing the appropriate date. A typical call to the date function could be echo date jS F Y This will produce a date of the format 27th August 2000 . The format codes accepted by date are listed in Table .