I have created a view from an entityform that I've set up in D7/views 3.8. There is a request date field in my entityform. The field type is date. i have set the format to be m/d/Y.

I added a date filter in the view that is not working. After typing in the date several times, I literally copied the date from the view results and pasted it into the filter box, to be sure there were no typos and the filter still returns no results.

So I put in 10/02/2014 and nothing is returned

Does anyone one know what could be happening here?

Update: Here is what I "think" I know. I changed the filter to "contains", [just for testing]. I then entered '10' quick apply, it returned all rows that had a 10, did the same for '01' and '2014', all return rows. So I assume, even though I change the date format m/d/Y, it is not that way in the db or the view, so my search for '10/01/2014' is not working because that exact string is not in the date field.

How can I confirm/check and then fix? My users need to search using m/d/Y format in the filter box.

Update2: so after thinking about the above update, I was able to successfully run a query using this format in the filter box '2014-10-01'. I went back to be sure I had added the m/d/Y format. It is there and is being pulled into my entityform correctly, so why is it not going to the db this way?

How can I fix?

  • You probably set the filter to 'Is equal to'. Even though the field has been rewritten to your format, the filter considers the field in the format CCYY-MM-DD HH:MM:SS Oct 2, 2014 at 13:31
  • Actually, I stand corrected. The filter takes any machine readable date format. For date fields attached to the base entity tables this format works: Y-m-d H:i:s. I think it is because it considers a granularity up to seconds. For dates added as fields using Date API you can set the granularity in the content type creation form. When you do the filter takes that granularity into consideration. Oct 2, 2014 at 14:03
  • First comment - the filter was original set to "is equal to", i then changed to "contains". When I changed to contains, and then entered date format as 2014-10-01, results were return. The my user needs to enter the 10/01/2014. I don't know how to accomplish that. Second comment: Where you mention granularity, I have that set to y m d. I unchecked the seconds Oct 2, 2014 at 14:41
  • In the content type field settings for date there is a 'MORE SETTINGS AND VALUES' dropdown where you can set the date entry options. Perhaps that will solve the issue. However, according to this post you cannot change it once it is set and have to delete and recreate the field. Oct 2, 2014 at 14:52
  • This is the kicker, I can change the format so it displays correctly for the user and goes to the db the way i want, but the query format has to 2014-10-03 format. Oct 5, 2014 at 13:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.