Date math and documentation

The other day I found this little nugget in the comments of the date page of PHP manual. The real lesson is in the first paragraph:

“One of the most useful skills you can utilize when performing date math is taking full advantage of the UNIX timestamp. The UNIX timestamp was built for this kind of work.”

The comment goes on to give some relevant examples. If you aren’t a fan of doing date math – in any language – take this concept to heart. It will make your life easier.

Comments like this are a great example of why the PHP Manual is one of the best reference manuals out there. I would bet that this documentation format has been a big driver behind the popularity of the language. Any good API, manual, or set documentation should include moderated comments.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

You can follow any discussion on this article with the RSS feed for this post.

About this article

Green Galoshes is a weblog written by Justin D. Henry. This entry was published on or around August 10, 2007.

Categories & Tags

This article is filed under code, qotd, reference. It is further described as , , , , , , , , , , .