Date

PEAR Date is a generic class to represent and work with dates. It does not use timestamps which means it can be used for dates before 1970 and after 2038. The class provides methods to convert a date in different formats, calculate differences, weekdays and more.

Examples

Following the saying "learning by doing", we start with some examples.

The first step to work with the class is to instantiate a Date object.

After finishing your work with the date object, you probably want to have it back. This can be done in different ways.

Date has a lot more methods to output your date, but that is subject of a later chapter.

Now that we know how to create a Date instance, we'll do some easy tasks.