The closest I have found to this is How can I filter a View by the value (or data) of field? which sounded perfect but it didn't work for me.

I need to show a list of values equal to or greater than today's date. For dates in the past, on a value formatted as a date, I use now and it works.

I built a view using webform submission data from the latest webform release, which enters a date field as text, for example 2014-05-08, into the database rather than a timestamp.

I can test it by entering the date into the filter value as 2014-05-08 and it works perfectly, but of course I need today's date to update automatically.

I tried using the token filter (Y-m-d) to get the current date, but nothing happens.

I have also installed the Views PHP module, but the following code didn't work.

$date = date('Y-m-d');  
if ($row > value_1 == $date) {
  return TRUE;

Is there a way to use tokens in the Configure filter criterion: value field?

1 Answer 1


I don't really understand the problem. When a date isn't a date anymore and you can use php you can just convert it back to a date.

You even almost use the correct function.

$submittedDate = $row>value_1;

$Cdate = date('Y-m-d');
$Sdate = date_format(date_create($submittedDate), 'Y-m-d');

if ($Sdate == $Cdate) {
    return TRUE;

Shouldn't that do the trick?

  • Yeah that looks ideal, but its having no effect on the results. I want to create an exposed filter for the field "event date" and show results for today and tomorrow, based on "now" and "now + 1 day". Is there anyway to convert the text into a date format, and then filter by that? That's the reason I thought printing the token in the value field might be a better way of doing it.
    – Collins
    May 11, 2014 at 14:00
  • 1
    You pointed me in the right direction, there was a bug in the views-php module that was returning the node ID for every value, so no wonder it wasnt converting it to a date! That was driving me nuts!
    – Collins
    May 11, 2014 at 14:42

Your Answer

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

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