Skip to main content
John Brandenburg

Main navigation

  • Home
  • About Me
  • Tech
  • Voting Rights
    • Close Polling Stations:
    • Reject Absentee Ballots
    • 482,000 de-registered voters in Wisconsin since 2016
    • Deceptive Practices by poll workers
    • Gerrymandering
    • Lack of Early Voting
    • Purge Voters
    • Removing Voting Rights from Former Felons
    • Unreliable Voting Equipment
    • Voter ID Laws
User account menu
  • Log in

Breadcrumb

  1. Home

PHP

By John, 17 May, 2016

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

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:

2016-00-00T00:00:00

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

2016-01-01 00:00:00 

Tags

  • Tech
  • PHP
PHP
RSS feed
Powered by Drupal