Chapter 3. TAKING THE PAIN OUT OF WORKING WITH DATES

TAKING THE PAIN OUT OF WORKING WITH DATES

It's a well-known fact that most of the formatting characters used by date() and strftime() seem to bear no logical relationship with the values they represent. Even the formatting characters, m (month) and d (date), used with date() aren't completely straightforward. Do they output a leading zero or not? (They do.) But if you don't want the leading zero, can you remember the right characters to use? OK, I'll put you out of your misery; it's n for month and j for date.

Wouldn't it be great if you could format dates in PHP without the need to look up the formatting characters in a book or the online ...

Get PHP Object-Oriented Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.