Chapter 7. Managing Dates and Times

Terms You’ll Need to Understand

  • UNIX time stamp

  • UNIX epoch

  • date arrays

  • UTC

  • Format strings

Techniques You’ll Need to Master

  • Handling dates in PHP

  • Getting the current date

  • Converting a string into a date

  • Formatting dates and times

In this chapter, you will learn how to parse and manipulate dates and times in PHP. Handling dates and times is an important day-to-day skill for many PHP programmers. You will learn how to generate times from various date formats and multiple ways of formatting dates in strings.

How PHP Handles Dates

In PHP, you deal with dates and times in three basic formats:

  • UNIX time stamps

  • Date arrays

  • String-formatted dates

Internally, PHP uses UNIX time stamps, which are the standard method of telling time on ...

Get Zend PHP Certification Study Guide now with O’Reilly online learning.

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