Answers.Body: <pre><code>$postDate = craft()-&gt;request-&gt;getPost('date');
  $nextDay = new DateTime($postDate);    
  'criteria' =&gt; [
      'section' =&gt; 'news',
      'date' =&gt; 'and,&gt;='.$postDate.',&lt;'.$nextDay-&gt;modify('+1 days')-&gt;format("Y-m-d"),
  ],
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-20T23:27:34.400Z
Answers.LastActivityDate: 2016-04-20T23:27:34.400Z
Answers.UserDisplayName: Vitaliy  Badalov
Answers.Body: <p>Something like this should work just for selecting a "day".</p>
  
  <pre><code>'criteria' =&gt; [
      'section' =&gt; 'news',
      'customDateFieldHandle' =&gt; ['and', '&gt;='.DateTime::createFromString(craft()-&gt;request-&gt;getPost('date'))-&gt;format("Y-m-d").' 00:00:00', '&lt;='.$DateTime::createFromString(craft()-&gt;request-&gt;getPost('date'))-&gt;format("Y-m-d").' 23:59:59')];
  ],
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T19:10:25.983Z
Answers.Text: you need to format the key and not the value
Answers.UserDisplayName: Vitaliy  Badalov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T19:30:09.913Z
Answers.Text: I'm not following... why?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T19:36:15.347Z
Answers.Text: I need entries certain with days, "date" this is date field and returns the date and time, and I need only a day
Answers.UserDisplayName: Vitaliy  Badalov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T19:37:33.603Z
Answers.Text: So you're searching against postDate?  Or a custom Date field?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T19:40:03.147Z
Answers.Text: is custom field
Answers.UserDisplayName: Vitaliy  Badalov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-08T18:03:05.813Z
Answers.Text: Updated answer.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T18:30:09.617Z
Answers.LastActivityDate: 2016-04-08T18:01:52.063Z
Answers.LastEditDate: 2016-04-08T18:01:52.063Z
Answers.UserDisplayName: Brad Bell
Body: <pre><code>'criteria' =&gt; [
      'section' =&gt; 'news',
      'date' =&gt; craft()-&gt;request-&gt;getPost('date')
  ],
  </code></pre>
  
  <p>How to make that worked like this:</p>
  
  <pre><code>'criteria' =&gt; [
      'section' =&gt; 'news',
      'date-&gt;format("Y-m-d")' =&gt; craft()-&gt;request-&gt;getPost('date')
  ],
  </code></pre>
  
Tags: <datetime><plugin-elementapi>
Title: Format keys in Element API plugin
ThreadText: # Format keys in Element API plugin
  
  (Asked by: username_0 on 2016-04-07)
  
  ```
  'criteria' => [
      'section' => 'news',
      'date' => craft()->request->getPost('date')
  ],
  
  ```
  
  How to make that worked like this:
  
  ```
  'criteria' => [
      'section' => 'news',
      'date->format("Y-m-d")' => craft()->request->getPost('date')
  ],
  
  ```
  
  **Tags:** datetime, plugin-elementapi
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-04-20. Score: 2 | Accepted answer
  
  ```
  $postDate = craft()->request->getPost('date');
  $nextDay = new DateTime($postDate);    
  'criteria' => [
      'section' => 'news',
      'date' => 'and,>='.$postDate.',<'.$nextDay->modify('+1 days')->format("Y-m-d"),
  ],
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2016-04-07. Score: 2
  
  Something like this should work just for selecting a "day".
  
  ```
  'criteria' => [
      'section' => 'news',
      'customDateFieldHandle' => ['and', '>='.DateTime::createFromString(craft()->request->getPost('date'))->format("Y-m-d").' 00:00:00', '<='.$DateTime::createFromString(craft()->request->getPost('date'))->format("Y-m-d").' 23:59:59')];
  ],
  
  ```
  
  > **Comments:**
  > **username_0**: you need to format the key and not the value  
  > **username_1**: I'm not following... why?  
  > **username_0**: I need entries certain with days, "date" this is date field and returns the date and time, and I need only a day  
  > **username_1**: So you're searching against postDate?  Or a custom Date field?  
  > **username_0**: is custom field  
  > **username_1**: Updated answer.  
  
  ---
  
  