Date Granularity in PHP and Drupal. Or where did this 11-30 come from?

Submitted by John on Tue, 05/17/2016 - 08:12

TL;DR: Why are my dates being converted to November 30th in PHP? Because zero is an invalid month and day.

One thing that strikes me odd is how to handle dates with wide granularities in PHP, and Drupal as usual. I came across this problem in a content migration project. In Drupal 6, a date field that was only granular to the year would like something like this:


However, a date field in D6 might look like this:

2016-01-01 00:00:00