2

Issue: Drupal Views module only displays Wed Dec 31, 1969 for date fields

I have created a CCK content field type called field_gse_event_start_time. I also have several views displays that use this field - a calendar view, a table view, and a block view for the home page. I also have a themed node template for the event content type that this field belongs to.

The start time field requires a 'to' date as well as a from date. I have tried to change the type of the field_gse_event_start_time to date, datetime, and datestamp. In all cases the node display of the fields is correct, but any view displays Wed Dec 31, 1969.

I am sure this is due to some casting error or null, which adjusts to this pre-epoc value.

I just don't even know where to begin or how to fix.

Some config Drupal core 6.26 ctools-6.x-1.8.tar date-6.x-2.9.tar views-6.x-2.16.tar

1 Answers1

0

You probably know that the 1969 date is returned by date() when you pass it an invalid epoch time and you have a negative timezone offset. So, date() will default the invalid epoch to 1, and the timezone offset makes it pre-epoch.

Why this is happening in your Drupal view is probably because of a views field handler expecting the wrong format. What field type are you using for field_gse_event_start_time?

Forest
  • 808
  • 6
  • 9
  • Thanks for the reply! I have it setup as a Datetime. I was assuming that was best practice for Drupal and Dates. Do I need to write a custom views field handler in PHP? Where do I find some 411 on that? – user1440273 Jun 06 '12 at 20:28