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 shared. Required fields are marked *