No matter what sort of web site you’re building, chances are that a fair amount of the code you write will be involved in the formatting, manipulation, and calculation of times and dates. This is because temporal data plays an important role in so many aspects of business and life. So, as a developer you’ll need to be well versed in creating features that perform tasks such as telling the user how many days have passed since he last logged in, including the customer’s product purchase date on an invoice, and retrieving a list of articles published to your web site within the past 30 days.
The PHP language has long sported powerful date formatting and manipulation capabilities, greatly reducing the amount of work the developer has to do in this regard. In his Web Developer’s Virtual Library tutorial, Jason Gilmore introduces you to some of PHP’s more commonly used date-manipulation features, and offer a few lesser-known tips and tricks along the way.
Displaying the Date
date() function is so impressive that many tutorials and books often use the function within an introductory example as a way to acquaint the user with the language’s simple yet powerful syntax. This function’s dizzying array of options make it possible to format a date and time in practically every conceivable manner (even Swatch Internet Time if you so desire).