I am trying to execute below SOQL using Salesforce REST API using Postman

services/data/v36.0/query?q=Select Id from Opportunity  where CloseDate < 2016-07-31T04:17:54

But I am getting below exception

    "message": "\nDAY_ONLY(CloseDate) < 2016-07-31T04:17:54\n                                        ^\nERROR at Row:1:Column:75\nline 1:75 no viable alternative at character '<EOF>'",
    "errorCode": "MALFORMED_QUERY"

I don't get what is wrong with the query.

I referred How to Apply a DateTime Filter when using SOQL via REST API and used DAY_ONLY function like below. But still got the same exception

services/data/v36.0/query?q=Select Id from Opportunity  where DAY_ONLY(CloseDate) < 2016-07-31T04:17:54

I've tried using the below formats of date, but of no use.

2016-07-31 04:17:54

What is I am missing over here?

  • Try 2016-07-31T04:17:54Z.
    – Adrian Larson
    Jul 29, 2016 at 13:37
  • @AdrianLarson- Tried and getting this error value of filter criterion for field 'CloseDate' must be of type date and should not be enclosed in quotes Jul 29, 2016 at 13:39
  • If you include time don't use DAY_ONLY. Otherwise drop everything before the T.
    – Adrian Larson
    Jul 29, 2016 at 13:40
  • @AdrianLarson - Tried both. Still getting the same error :( Jul 29, 2016 at 13:50

1 Answer 1


The CloseDate field is of the Date type. That means you should not include a time component in your filter value. This query works for me in the Developer Workbench. Should be the same for you in Postman, I'd think.


Specifically, the date format is 2016-07-31.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .