Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I've managed to get my webform fields to display in views via this tutorial. The tutorial uses the Webform My SQL views and data modules.

Webmform My SQL views: 7.x -1.0 Data: 7.x-1.0 alpha

System: Plesk 10.3 CentOS 5.8 Apache 2.2.3 Php 5.1.6

I can successfully create my view that allows me to choose the webform fields I want to display, however, when i try to add the "Webform views request time off 272: Submitted" date field, I get this:

Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in format_date() (line 1909 of /var/www/vhosts/mydomain.com/intranet/includes/common.inc).

Warning: date_format() expects parameter 1 to be DateTime, boolean given in format_date() (line 1919 of /var/www/vhosts/mydomain.com/intranet/includes/common.inc).

As a result, this field displays no values.

I've done a search on that issue and while I did find some topics, I'm not sure how they apply to my situation. Unfortunately, this site is for our intranet so I cannot post a link.

The goal in this view is to show the submission fields and include a filter control that I can expose to the user that uses the submission date as the criteria for a date range.

I had the "Date" module activated, then deactivated which didn't resolve the issue.

Any help would be greatly appreciated.

share|improve this question

closed as too broad by kiamlaluno May 4 at 7:03

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

I ran into the very same 2 errors but in the context of of sub-theme preprocess function when using the format_date() function as follows.

$vars['timestamp'] = format_date($dc_file_items[0]['timestamp'], 'custom', 'd M, Y');

After searching in many directions (including installing the Date module - not required), I came to realize that $dc_file_items[0]['timestamp'] was returning a string and not an integer. Adding intval() around it made the errors disappear. In the end, the code above should look like this.

$vars['timestamp'] = format_date(intval($dc_file_items[0]['timestamp']), 'custom', 'd M, Y');

Hope this helps.

share|improve this answer

As its said date_timezone_set() expects parameter 1 to be DateTime type so you have to send the DateTime value to the variable or you have to apply this patch to get rid of warning.

And always "Expects parameter xxx to be "xxxtype" error is data type casting problem ". to solve this you have to send data in that data type format or you have to handle it in the core file by applying this patch.
https://www.drupal.org/node/518816 https://www.drupal.org/files/issues/518816-5.date_format_date_warnings.patch

believe it helps you

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.