Answers.Body: <p>It seems like a syntax error, you did not set the date correctly. This should work</p>
  
  <pre><code>    $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
      $criteria-&gt;section = 'inspections';
      $criteria-&gt;inspectionDate = "&gt;" . time();
      $criteria-&gt;order = 'dateCreated asc';
      $inspections = $criteria-&gt;find();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-28T13:08:17.673Z
Answers.LastActivityDate: 2017-11-28T13:08:17.673Z
Answers.UserDisplayName: Robin Schambach
Answers.Body: <p>The Error was because </p>
  
  <blockquote>
    <p>$criteria->inspectionDate > '("now")';</p>
  </blockquote>
  
  <p>This way you can't get today's date.</p>
  
  <p>You could try this:</p>
  
  <pre><code>$date = new DateTime();
  $formattedDate = $date-&gt;format(DateTime::MYSQL_DATETIME);
  $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
  $criteria-&gt;section = 'inspections';
  $criteria-&gt;inspectionDate = '&gt; '.$formattedDate;
  $criteria-&gt;order = 'dateCreated asc';
  $inspections = $criteria-&gt;find();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-29T01:24:25.190Z
Answers.Text: im marking Robins answer as correct for simplicity sake, your answer works as well.
Answers.UserDisplayName: Matthew
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-28T13:02:03.750Z
Answers.LastActivityDate: 2017-11-28T13:10:06.233Z
Answers.LastEditDate: 2017-11-28T13:10:06.233Z
Answers.UserDisplayName: hashtagerrors
Body: <p>I am trying to retrieve an array of entries on a particular section where <code>inspectionDate</code> is greater than today's date. Here is the code.</p>
  
  <pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
  $criteria-&gt;section = 'inspections';
  $criteria-&gt;inspectionDate &gt; '("now")';
  $criteria-&gt;order = 'dateCreated asc';
  $inspections = $criteria-&gt;find();
  </code></pre>
  
  <p>I am getting a <code>Property "Craft\ElementCriteriaModel.inspectionDate" is not defined.</code> error when trying to run this code.I have made sure that inspectionDate is the field handle and is also a date type.</p>
  
Tags: <plugin-development><elementcriteriamodel><custom-fieldtype><custom-field>
Title: Retrieve entries on custom field date using ElementCriteriaModel
ThreadText: # Retrieve entries on custom field date using ElementCriteriaModel
  
  (Asked by: username_0 on 2017-11-28)
  
  I am trying to retrieve an array of entries on a particular section where `inspectionDate` is greater than today's date. Here is the code.
  
  ```
  $criteria = craft()->elements->getCriteria(ElementType::Entry);
  $criteria->section = 'inspections';
  $criteria->inspectionDate > '("now")';
  $criteria->order = 'dateCreated asc';
  $inspections = $criteria->find();
  
  ```
  
  I am getting a `Property "Craft\ElementCriteriaModel.inspectionDate" is not defined.` error when trying to run this code.I have made sure that inspectionDate is the field handle and is also a date type.
  
  **Tags:** plugin-development, elementcriteriamodel, custom-fieldtype, custom-field
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-11-28. Score: 2 | Accepted answer
  
  It seems like a syntax error, you did not set the date correctly. This should work
  
  ```
      $criteria = craft()->elements->getCriteria(ElementType::Entry);
      $criteria->section = 'inspections';
      $criteria->inspectionDate = ">" . time();
      $criteria->order = 'dateCreated asc';
      $inspections = $criteria->find();
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2017-11-28. Score: 2
  
  The Error was because
  
  > $criteria->inspectionDate > '("now")';
  
  This way you can't get today's date.
  
  You could try this:
  
  ```
  $date = new DateTime();
  $formattedDate = $date->format(DateTime::MYSQL_DATETIME);
  $criteria = craft()->elements->getCriteria(ElementType::Entry);
  $criteria->section = 'inspections';
  $criteria->inspectionDate = '> '.$formattedDate;
  $criteria->order = 'dateCreated asc';
  $inspections = $criteria->find();
  
  ```
  
  > **Comments:**
  > **username_0**: im marking Robins answer as correct for simplicity sake, your answer works as well.  
  
  ---
  
  