The Date/Time PHP extension is a set of classes that allow you to work with almost all of the date and time related tasks. It’s been available since the release of PHP 5.2 and the extension introduced several new classes, all of which are mapped to real life scenarios.
- A date or a time is represented by a DateTime object.
- A timezone of the world is represented by a DateTimeZone object.
- DateInterval objects represent an interval. For example, when we say two days from now on, the “two days” is the interval. The DateInterval object doesn’t rely on a specific date or time.
- DatePeriod objects represent a period between two dates.