O'Reilly logo

PHP 5 Recipes: A Problem-Solution Approach by Jon Stephens, Frank M. Kromann, Nathan A. Good, Lee Babin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 5Working with Dates and Times

Dates and times are quite unlike most other sorts of data you are likely to encounter when programming with PHP 5. Arrays, whether they are indexed arrays or associative arrays, are nicely structured. So are strings. Numbers are—well, they are numbers, and despite a few bumps here and there because of issues such as rounding, you are still obliged to work with a fairly limited set of mathematical operations and formatting functions. However, dates are rather messy with respect to both calculation and representation, and one is about as bad as the other.

Quick question: what were the date and time exactly 101 hours, 44 minutes, and 15 seconds prior to 7:35 p.m. on September 17, 1989? And what day of the week ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required