O'Reilly logo

PHP and MySQL by Example by Marko Gargenta, Ellie Quigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix CPHP and Date/Time

Working with dates and time is reasonably easy, but can be quite complex when dealing with different time zones, Daylight Saving Time, and so on. PHP offers a range of functions to handle date and time, and many of these functions use the UNIX timestamp, the number of seconds since July 1, 1970, 00:00:00 GMT, also called the epoch.

We cover some of the functions that deal with the timestamps and those that are used to format the date and time. If you are just interested in formatting the date and time, the easiest way to get formatted date strings is with the date() and the strftime() functions.

C.1 Formatting Dates and Times

C.1.1 The date() Function

The date() function is used to format ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required